From commits@source.squeak.org Sun Feb 11 01:17:08 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: System-codefrau.1446.mcz Date: Sun, 11 Feb 2024 01:16:55 +0000 Message-ID: <20240211011706.3C293583CF7@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5713799577349768554==" --===============5713799577349768554== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Vanessa Freudenberg uploaded a new version of System to project The Trunk: http://source.squeak.org/trunk/System-codefrau.1446.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: System-codefrau.1446 Author: codefrau Time: 10 February 2024, 5:09:57.063937 pm UUID: 52c0d3db-d7c2-49b0-89ae-9dcba8aa1c60 Ancestors: System-ct.1445 Fix VM vmUpdateURL =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against System-ct.1445 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: SystemVersion>>recommendedVMBuildNumber (in category 'accessi= ng') ----- recommendedVMBuildNumber + "This is used to construct #vmUpdateURL, make sure the release actually ex= ists" -=20 ^ 202312181441! Item was changed: ----- Method: SystemVersion>>vmUpdateURL (in category 'accessing') ----- vmUpdateURL =20 + ^ 'https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/', self = recommendedVMBuildNumber! - ^ 'https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/20220602= 1410'! --===============5713799577349768554==-- From commits@source.squeak.org Mon Feb 12 15:54:39 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: MonticelloConfigurations-mt.185.mcz Date: Mon, 12 Feb 2024 15:54:34 +0000 Message-ID: <20240212155437.0BF35582701@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1478591222698849657==" --===============1478591222698849657== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Marcel Taeumel uploaded a new version of MonticelloConfigurations to project = The Trunk: http://source.squeak.org/trunk/MonticelloConfigurations-mt.185.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: MonticelloConfigurations-mt.185 Author: mt Time: 12 February 2024, 4:54:34.878007 pm UUID: ca6f400d-f79c-d34b-be8e-5c02cfb06f04 Ancestors: MonticelloConfigurations-mt.184 In the update dialog, slightly reformat the "New VM recommended" message to h= ave current and new version numbers be on the same line. Make the current one= bold as it is with the current build number above. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against MonticelloConfigur= ations-mt.184 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: MCMcmUpdater>>updateMessageFor: (in category 'private') ----- updateMessageFor: previousUpdateLevel =20 | ciTemplate ciStamp | ciTemplate :=3D '
CI status: {9}'. ciStamp :=3D SystemVersion current ciStatusTimestamp ifNil: [SystemVersion current isRelease ifTrue: [ciTemplate :=3D '' "Drop outdated/unavailable CI info for relea= ses"] ifFalse: ['(build inaccessible!!)' translated]]. =20 ^ ('Update completed.

Version: {1}
Update: {3}{2}

= Url:
{4}
Map: ''{5}''', ciTemplate, '{6}{11}' trans= lated format: { SystemVersion current version escapeEntities. SystemVersion current highestUpdate. (previousUpdateLevel =3D SystemVersion current highestUpdate ifTrue: [''] ifFalse: [previousUpdateLevel asString, ' -> ']) escapeEntities. self repository escapeEntities. MCMcmUpdater updateMapName escapeEntities. SystemVersion current description ifEmpty: [''] ifNotEmpty: [:d | '

{1}' format: { d escapeEntities. Preferences standardButtonFont familyName. Preferences standardButtonFont pointSize. }]. SystemVersion current ciStatusBadgeUrl. SystemVersion current ciStatusPageUrl. ciStamp. "mt: Avoid triggering the Windows Defender. See http://lists.squeakfound= ation.org/pipermail/squeak-dev/2021-December/217346.html" 'a'. SystemVersion current recommendedVMUpdateInfo ifNil: [''] ifNotNil: [:in= fo | + '

A newer VM is recommended. Vis= it the
project page to download it. Manual image save, = quit, and restart will be required.
{1} -> {2}
' translated - '

A newer VM is recommended ({1}= -> {2})!! Visit the
project page to download it.' translated format: { info key. info value. SystemVersion current vmUpdateURL. 'a'. "avoid Windows Defender again" Preferences standardButtonFont familyName. Preferences standardButtonFont pointSize }] }) asTextFromHtml! --===============1478591222698849657==-- From commits@source.squeak.org Mon Feb 12 17:04:37 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Regex-Core-ct.87.mcz Date: Mon, 12 Feb 2024 17:04:32 +0000 Message-ID: <20240212170435.5A873583F39@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1478184640971170071==" --===============1478184640971170071== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Regex-Core to project The Trunk: http://source.squeak.org/trunk/Regex-Core-ct.87.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Regex-Core-ct.87 Author: ct Time: 12 February 2024, 6:04:30.043873 pm UUID: 14f07474-9952-e740-9548-3edfe838a9eb Ancestors: Regex-Core-ct.86 Fixes regex escaping of pipe characters ('|' escapeForRegex). =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Regex-Core-ct.86 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: RxParser class>>specialCharacters (in category 'utilities') -= ---- specialCharacters =20 + ^ '()[]*+?{}.^$:\|'! - ^ '()[]*+?{}.^$:\'! --===============1478184640971170071==-- From commits@source.squeak.org Mon Feb 12 22:17:06 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Monticello-eem.806.mcz Date: Mon, 12 Feb 2024 22:16:59 +0000 Message-ID: <20240212221704.2401B583F39@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1502481334890916649==" --===============1502481334890916649== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Eliot Miranda uploaded a new version of Monticello to project The Trunk: http://source.squeak.org/trunk/Monticello-eem.806.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Monticello-eem.806 Author: eem Time: 12 February 2024, 2:16:55.744 pm UUID: 450ea539-e238-4b2f-9f81-d2e0fa950ce7 Ancestors: Monticello-mt.805 Make sure class definitions are filed out correectly via fileOut ours/fileOut= theirs from version difference browsers. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Monticello-mt.805 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: MCClassDefinition>>fileOutOn: (in category 'printing') ----- + fileOutOn: aStream + "File out the receiver's definition, metaclass definition, and class comme= nt in chunk format. + Override to chunk all three elements." + (MCStWriter on: aStream) visitClassDefinition: self! --===============1502481334890916649==-- From commits@source.squeak.org Tue Feb 13 03:13:41 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Treated Inbox: System-cmm.1447.mcz Date: Tue, 13 Feb 2024 03:13:37 +0000 Message-ID: <20240213031339.9A12F583F63@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5544921616838227101==" --===============5544921616838227101== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Chris Muller uploaded a new version of System to project The Treated Inbox: http://source.squeak.org/treated/System-cmm.1447.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: System-cmm.1447 Author: cmm Time: 12 February 2024, 3:06:16.671515 pm UUID: 03b7d234-da01-4b78-94c0-f78c01d4afe0 Ancestors: System-codefrau.1446 FileStream's stdout and stderr are for Linux, so use Linux line-endings when = writing to them. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against System-codefrau.14= 46 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: CodeLoader>>installSourceFile: (in category 'installing') ---= -- installSourceFile: aStream "Install the previously loaded source file" | contents trusted | aStream ifNil:[^self error:'No content to install']. trusted :=3D SecurityManager default positionToSecureContentsOf: aStream. trusted ifFalse:[(SecurityManager default enterRestrictedMode)=20 ifFalse:[ aStream close. ^ self error:'Insecure content encountered']]. contents :=3D self allButShebangLine: aStream upToEnd unzipped asString. (aStream respondsTo: #close) ifTrue:[aStream close]. ^[contents readStream fileIn]=20 on: SyntaxErrorNotification=20 do: [ : err | Smalltalk isHeadless ifTrue:=20 + [FileStream stdout nextPutAll: err errorCode; lf; flush. - [FileStream stdout nextPutAll: err errorCode; cr; flush. Smalltalk snapshot: false andQuit: true ] ifFalse: [err pass] ]! Item was changed: ----- Method: Exception>>printVerboseOn: (in category '*system') ----- printVerboseOn: aStream=20 aStream nextPutAll: 'vvvvvvvvvvvvvvvvvv ' , self description , ' vvvvvvvvvvvvvvvv= vv' ; + lf ; - cr ; nextPutAll: 'The time is ', DateAndTime now asString ; + lf. - cr. "Allow applications to optionally print extra details without overriding a= base package." self printDetailsOn: aStream. aStream nextPutAll: self signalerContext longStack ; + lf ; - cr ; nextPutAll: '^^^^^^^^^^^^^^^^^^ ' , self description , ' ^^^^^^^^^^^^^^^^= ^^' ; + lf ; - cr ; flush! Item was changed: ----- Method: SmalltalkImage>>run: (in category 'command line') ----- run: aBlock [ [ self patchSystem. (aBlock numArgs =3D 1 and: [ self arguments size > 1 ]) ifTrue: [ "Allow a large, variable number of arguments to be passed as an= Array to aBlock." aBlock value: self arguments ] ifFalse: [ aBlock valueWithEnoughArguments: self arguments ] ] on: SyntaxErrorNotification do: [ : err | FileStream stdout nextPutAll: err errorCode ; + lf; flush. - cr; flush. self isHeadless ifTrue: [ self snapshot: false andQuit: true ] ifFalse: [ err pass ] ] on: Error , ProvideAnswerNotification do: [ : err | err printVerboseOn: FileStream stderr. FileStream stderr flush. self isHeadless ifTrue: [ self snapshot: false andQuit: true ] ifFalse: [ err pass ] ] on: ProgressInitiationException do: [ : pie | "Don't want to log this Notification." pie defaultAction ] ] on: Notification , Warning do: [ : noti | FileStream stdout nextPutAll: DateAndTime now asString ; space ; nextPutAll: noti description ; + lf. - cr. noti resume ] ! --===============5544921616838227101==-- From commits@source.squeak.org Wed Feb 14 12:41:19 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Morphic-mt.2152.mcz Date: Wed, 14 Feb 2024 12:41:09 +0000 Message-ID: <20240214124117.826DF58270A@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2471336378827558385==" --===============2471336378827558385== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Marcel Taeumel uploaded a new version of Morphic to project The Trunk: http://source.squeak.org/trunk/Morphic-mt.2152.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Morphic-mt.2152 Author: mt Time: 14 February 2024, 1:41:08.155344 pm UUID: 2437b99d-d4cc-2647-b5f1-efbc85d16c89 Ancestors: Morphic-dtl.2151 In a button's debug menu (via halo), add spy-on shortcut besides debug-it and= browse-it. Useful for profiling the effects of a button click. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Morphic-dtl.2151 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: MenuItemMorph>>buildDebugMenu: (in category 'browse') ----- buildDebugMenu: aHandMorph | aMenu | aMenu :=3D super buildDebugMenu: aHandMorph. aMenu addLine. aMenu add: 'browse action code' translated target: self action: #browseImp= lementationOfActionSelector. aMenu lastItem isEnabled: self selector notNil. aMenu add: 'debug action invocation' translated target: self action: #debu= gAction. aMenu lastItem isEnabled: self selector notNil. + aMenu add: 'spy on action invocation' translated target: self action: #spy= OnAction. + aMenu lastItem isEnabled: self selector notNil.=09 ^ aMenu! Item was added: + ----- Method: MenuItemMorph>>spyOnAction (in category 'browse') ----- + spyOnAction +=20 + TimeProfileBrowser spyOn: [self doButtonAction].! Item was changed: ----- Method: PluggableButtonMorph>>buildDebugMenu: (in category 'debug men= u') ----- buildDebugMenu: aHandMorph | aMenu | aMenu :=3D super buildDebugMenu: aHandMorph. aMenu addLine. aMenu add: 'browse action code' translated target: self action: #browseImp= lementationOfActionSelector. aMenu add: 'debug action invocation' translated target: self action: #debu= gAction. + aMenu add: 'spy on action invocation' translated target: self action: #spy= OnAction. ^ aMenu! Item was added: + ----- Method: PluggableButtonMorph>>spyOnAction (in category 'debug menu') = ----- + spyOnAction +=20 + self updateArguments. + TimeProfileBrowser spyOn: [self doButtonAction].! Item was changed: ----- Method: SimpleButtonMorph>>buildDebugMenu: (in category 'debug menu')= ----- buildDebugMenu: aHandMorph =20 | aMenu | aMenu :=3D super buildDebugMenu: aHandMorph. aMenu addLine. aMenu add: 'browse action code' translated target: self action: #browseImp= lementationOfActionSelector. aMenu add: 'debug action invocation' translated target: self action: #debu= gAction. + aMenu add: 'spy on action invocation' translated target: self action: #spy= OnAction.=09 ^ aMenu! Item was added: + ----- Method: SimpleButtonMorph>>spyOnAction (in category 'debug menu') ---= -- + spyOnAction +=20 + TimeProfileBrowser spyOn: [self doButtonAction].! --===============2471336378827558385==-- From commits@source.squeak.org Wed Feb 14 12:41:54 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: ToolBuilder-Morphic-mt.349.mcz Date: Wed, 14 Feb 2024 12:41:47 +0000 Message-ID: <20240214124151.4AC46583C06@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3324121261647121006==" --===============3324121261647121006== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Marcel Taeumel uploaded a new version of ToolBuilder-Morphic to project The T= runk: http://source.squeak.org/trunk/ToolBuilder-Morphic-mt.349.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: ToolBuilder-Morphic-mt.349 Author: mt Time: 14 February 2024, 1:41:47.973344 pm UUID: 62ccb225-9c52-7f48-ac71-1f16e95c83b5 Ancestors: ToolBuilder-Morphic-mt.348 Complement Morphic-mt.2152 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against ToolBuilder-Morphi= c-mt.348 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: PluggableButtonMorphPlus>>spyOnAction (in category 'debug men= u') ----- + spyOnAction +=20 + action ifNil: [^ super spyOnAction]. + TimeProfileBrowser spyOn: [self performAction].! --===============3324121261647121006==-- From commits@source.squeak.org Wed Feb 14 13:44:05 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Graphics-mt.550.mcz Date: Wed, 14 Feb 2024 13:43:58 +0000 Message-ID: <20240214134403.C7406583C23@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2191770166503763672==" --===============2191770166503763672== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Marcel Taeumel uploaded a new version of Graphics to project The Trunk: http://source.squeak.org/trunk/Graphics-mt.550.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Graphics-mt.550 Author: mt Time: 14 February 2024, 2:43:57.021709 pm UUID: e7ee4cb8-e57d-0a4e-bf06-ab05629b9bb6 Ancestors: Graphics-mt.549 Remove unused x-width data for "DejaVu Sans Bold 13". We do not have the form= data because size 13 is not supported. Only 12, 14, 17, ... and others. Thanks to Levente (ul) for the hint! =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Graphics-mt.549 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was removed: - ----- Method: StrikeFont class>>dejaVuSansBold13Data (in category 'dejaVu f= ont data') ----- (excessive size, no diff calculated) --===============2191770166503763672==-- From commits@source.squeak.org Sun Feb 18 16:30:56 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Treated Inbox: System-dtl.1445.mcz Date: Sun, 18 Feb 2024 16:30:50 +0000 Message-ID: <20240218163053.E715D583C05@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3139290554838361321==" --===============3139290554838361321== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable David T. Lewis uploaded a new version of System to project The Treated Inbox: http://source.squeak.org/treated/System-dtl.1445.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: System-dtl.1445 Author: dtl Time: 28 January 2024, 8:13:53.851653 pm UUID: 8b191722-da0b-442e-ae5d-3e23a344e720 Ancestors: System-ct.1444 Add class LowSpaceWatcher and move the low space watcher from SmalltalkImage = to LowSpaceWatcher. Let the low space watcher be a singleton with responsibil= ity for the low space semaphore and low space watcher process. Add class and = method comments to document intended behavior. Improve documentation of the low space watcher mechanism: HelpBrowser openOn: LowSpaceWatcher Also add #registerCleaner for adding savvy memory hogs to the memory hog regi= stry. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against System-ct.1444 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + Object subclass: #LowSpaceWatcher + instanceVariableNames: 'lowSpaceProcess lowSpaceSemaphore' + classVariableNames: 'Default MemoryHogs' + poolDictionaries: '' + category: 'System-Support'! +=20 + !LowSpaceWatcher commentStamp: 'dtl 1/28/2024 17:56' prior: 0! + LowSpaceWatcher is responsible for responding to a notification from the vi= rtual machine that memory is low and that it (the VM) may soon be unable to s= upport additional object memory allocations. A single default instance for th= e image manages both the low space semaphore and the process that waits on th= e semaphore to handle low space conditions. When the low space watcher is not= ified that memory is low, it attempts to identify the process likely associat= ed with the low space condition and to provide a notifier to allow the proble= m condition to be corrected. +=20 + If a low space condition is detected in the virtual machine, the low space = semaphore is signalled either directly by the VM or indirectly through an Out= OfMemory error following a failed primitive invocation. The VM is responsible= for identifying low space conditions, and its behavior will vary depending o= n both the VM implementation and the memory system of the underlying platform= operating system. In particular, on a virtual machine operating system the V= M may continue to receive memory allocations from the operating system while = the operating system attempts to support the memory requests by increased swa= pping to disk. Under these conditions, the low space semaphore may not be sig= nalled because system memory still appears to be available, even though perfo= rmance is severely degraded due to swapping. +=20 + The VM may provide control of its memory usage, typically through command l= ine parameters or VM parameters that can be set from the image. These paramet= ers will affect when and if the low space watcher is signalled by the VM. +=20 + A registry is maintained in class variable MemoryHogs to identify objects (= classes) know how to release unneeded memory when sent the message #freeSomeS= pace. The low space watcher process will send this message when a low spaced = condition is encountered. +=20 + To signal the low space watcher and simulate a low space condition, evaluat= e "LowSpaceWatcher default signalLowSpace".! Item was added: + ----- Method: LowSpaceWatcher class>>default (in category 'instance creatio= n') ----- + default + "The singleton low space watcher." +=20 + ^ Default ifNil: [ Default :=3D self new start ] + ! Item was added: + ----- Method: LowSpaceWatcher class>>install (in category 'instance creatio= n') ----- + install + "Start a process to watch for low-space conditions." + "Smalltalk installLowSpaceWatcher" +=20 + self default stop; start +=20 + ! Item was added: + ----- Method: LowSpaceWatcher class>>registerCleaner: (in category 'memory = hog registry') ----- + registerCleaner: memoryCleaner + "Add memoryCleaner to the MemoryHog list where memoryCleaner is an object = or class that responds to #freeSomeSpace." +=20 + (memoryCleaner respondsTo: #freeSomeSpace) + ifFalse: [ ^ self error: memoryCleaner asString, ' does not understand #f= reeSomeSpace' ]. + (self default memoryHogs includes: memoryCleaner) + ifFalse: [ MemoryHogs add: memoryCleaner ].! Item was added: + ----- Method: LowSpaceWatcher class>>signalLowSpace (in category 'signal lo= w space') ----- + signalLowSpace + "Signal the low-space semaphore to alert the user that space is running lo= w." +=20 + ^ self default signalLowSpace.! Item was added: + ----- Method: LowSpaceWatcher>>lowSpaceChoices (in category 'memory space')= ----- + lowSpaceChoices + "Return a notifier message string to be presented when space is running lo= w." +=20 + ^ 'Warning!! Squeak is almost out of memory!! +=20 + Low space detection is now disabled. It will be restored when you close or = proceed from this error notifier. Don''t panic, but do proceed with caution. +=20 + Here are some suggestions: +=20 + If you suspect an infinite recursion (the same methods calling each other = again and again), then close this debugger, and fix the problem. +=20 + If you want this computation to finish, then make more space available (re= ad on) and choose "proceed" in this debugger. Here are some ways to make more= space available... + > Close any windows that are not needed. + > Get rid of some large objects (e.g., images). + > Leave this window on the screen, choose "save as..." from the screen m= enu, quit, restart the Squeak VM with a larger memory allocation, then restar= t the image you just saved, and choose "proceed" in this window. +=20 + If you want to investigate further, choose "debug" in this window. Do not= use the debugger "fullStack" command unless you are certain that the stack i= s not very deep. (Trying to show the full stack will definitely use up all re= maining memory if the low-space problem is caused by an infinite recursion!!). +=20 + ' + ! Item was added: + ----- Method: LowSpaceWatcher>>lowSpaceWatcher (in category 'process') ----- + lowSpaceWatcher + "Wait until the low space semaphore is signalled, then take appropriate ac= tions." +=20 + | free preemptedProcess | + Smalltalk garbageCollectMost <=3D Smalltalk lowSpaceThreshold + ifTrue: [self garbageCollect <=3D Smalltalk lowSpaceThreshold + ifTrue: ["free space must be above threshold before + starting low space watcher" + ^ Beeper beep]]. +=20 + Smalltalk specialObjectsArray at: 23 put: nil. "process causing low space= will be saved here" + lowSpaceSemaphore :=3D Semaphore new. + self primLowSpaceSemaphore: lowSpaceSemaphore. + self primSignalAtBytesLeft: Smalltalk lowSpaceThreshold. "enable low spac= e interrupts" +=20 + lowSpaceSemaphore wait. "wait for a low space condition..." +=20 + self primSignalAtBytesLeft: 0. "disable low space interrupts" + self primLowSpaceSemaphore: nil. + lowSpaceProcess :=3D nil. +=20 + "The process that was active at the time of the low space interrupt." + preemptedProcess :=3D (Smalltalk specialObjectsArray at: 23) + ifNil: [Processor preemptedProcess "if in-image signal of OutOfMemory"]. + Smalltalk specialObjectsArray at: 23 put: nil. +=20 + "Note: user now unprotected until the low space watcher is re-installed" +=20 + self memoryHogs isEmpty + ifFalse: [free :=3D Smalltalk bytesLeft. + self memoryHogs + do: [ :hog | hog freeSomeSpace ]. + self bytesLeft > free + ifTrue: [ ^ LowSpaceWatcher installLowSpaceWatcher ]]. +=20 + Preferences logDebuggerStackToFile ifTrue: [ + self + logError: 'Space is low' + inContext: preemptedProcess suspendedContext + to: 'LowSpaceDebug.log']. + =09 + Project current + interruptName: 'Space is low' + message: self lowSpaceChoices + preemptedProcess: preemptedProcess + ! Item was added: + ----- Method: LowSpaceWatcher>>lowSpaceWatcherProcess (in category 'process= ') ----- + lowSpaceWatcherProcess + "Answer the process in which lowSpaceWatcher is running. A process browser + can use this to identify and label the system wide low space watcher proce= ss." + ^lowSpaceProcess! Item was added: + ----- Method: LowSpaceWatcher>>memoryHogs (in category 'memory space') ----- + memoryHogs + "Answer the list of objects to notify with #freeSomeSpace if memory gets f= ull." +=20 + ^ MemoryHogs ifNil: [MemoryHogs :=3D OrderedCollection new]! Item was added: + ----- Method: LowSpaceWatcher>>primLowSpaceSemaphore: (in category 'primiti= ve access') ----- + primLowSpaceSemaphore: aSemaphore + "Primitive. Register the given Semaphore to be signalled when the + number of free bytes drops below some threshold. Disable low-space + interrupts if the argument is nil." +=20 + + self primitiveFailed! Item was added: + ----- Method: LowSpaceWatcher>>primSignalAtBytesLeft: (in category 'primiti= ve access') ----- + primSignalAtBytesLeft: numBytes + "Tell the interpreter the low-space threshold in bytes. When the free + space falls below this threshold, the interpreter will signal the low-space + semaphore, if one has been registered. Disable low-space interrupts if the + argument is zero. Fail if numBytes is not an Integer." +=20 + + self primitiveFailed! Item was added: + ----- Method: LowSpaceWatcher>>signalLowSpace (in category 'memory space') = ----- + signalLowSpace + "Signal the low-space semaphore to alert the user that space is running lo= w." +=20 + lowSpaceSemaphore signal.! Item was added: + ----- Method: LowSpaceWatcher>>start (in category 'initialize-release') ---= -- + start + "Start a new low space watcher process that will register a semaphore with= the + virtual machine and wait for the semaphore to be signalled if a low space = condition + is detected." +=20 + lowSpaceProcess :=3D [self lowSpaceWatcher] newProcess. + lowSpaceProcess priority: Processor lowIOPriority. + lowSpaceProcess resume. + ! Item was added: + ----- Method: LowSpaceWatcher>>stop (in category 'initialize-release') ----- + stop. + "Ask the virtual machine to disable low space interrupts, then terminate t= he watcher process." +=20 + self primSignalAtBytesLeft: 0. "disable low-space interrupts" + lowSpaceProcess =3D=3D nil ifFalse: [lowSpaceProcess terminate]. + lowSpaceProcess :=3D lowSpaceSemaphore :=3D nil. + ! Item was changed: Object subclass: #SmalltalkImage instanceVariableNames: 'globals' + classVariableNames: 'EndianCache LastImageName LastQuitLogPosition LastSta= ts PlatformNameCache ShutDownList SourceFileVersionString StartUpList Startup= Stamp VMMakerVersion WordSize' - classVariableNames: 'EndianCache LastImageName LastQuitLogPosition LastSta= ts LowSpaceProcess LowSpaceSemaphore MemoryHogs PlatformNameCache ShutDownLis= t SourceFileVersionString StartUpList StartupStamp VMMakerVersion WordSize' poolDictionaries: '' category: 'System-Support'! =20 !SmalltalkImage commentStamp: 'dtl 3/6/2010 14:00' prior: 0! I represent the current image and runtime environment, including system org= anization, the virtual machine, object memory, plugins and source files. My i= nstance variable #globals is a reference to the system dictionary of global v= ariables and class names. =20 My singleton instance is called Smalltalk.! Item was changed: ----- Method: SmalltalkImage>>installLowSpaceWatcher (in category 'memory s= pace') ----- installLowSpaceWatcher "Start a process to watch for low-space conditions." "Smalltalk installLowSpaceWatcher" =20 + LowSpaceWatcher install - self primSignalAtBytesLeft: 0. "disable low-space interrupts" - LowSpaceProcess =3D=3D nil ifFalse: [LowSpaceProcess terminate]. - LowSpaceProcess :=3D [self lowSpaceWatcher] newProcess. - LowSpaceProcess priority: Processor lowIOPriority. - LowSpaceProcess resume. =20 ! Item was removed: - ----- Method: SmalltalkImage>>lowSpaceChoices (in category 'memory space') = ----- - lowSpaceChoices - "Return a notifier message string to be presented when space is running lo= w." -=20 - ^ 'Warning!! Squeak is almost out of memory!! -=20 - Low space detection is now disabled. It will be restored when you close or = proceed from this error notifier. Don''t panic, but do proceed with caution. -=20 - Here are some suggestions: -=20 - If you suspect an infinite recursion (the same methods calling each other = again and again), then close this debugger, and fix the problem. -=20 - If you want this computation to finish, then make more space available (re= ad on) and choose "proceed" in this debugger. Here are some ways to make more= space available... - > Close any windows that are not needed. - > Get rid of some large objects (e.g., images). - > Leave this window on the screen, choose "save as..." from the screen m= enu, quit, restart the Squeak VM with a larger memory allocation, then restar= t the image you just saved, and choose "proceed" in this window. -=20 - If you want to investigate further, choose "debug" in this window. Do not= use the debugger "fullStack" command unless you are certain that the stack i= s not very deep. (Trying to show the full stack will definitely use up all re= maining memory if the low-space problem is caused by an infinite recursion!!). -=20 - ' - ! Item was removed: - ----- Method: SmalltalkImage>>lowSpaceWatcher (in category 'memory space') = ----- - lowSpaceWatcher - "Wait until the low space semaphore is signalled, then take appropriate ac= tions." -=20 - | free preemptedProcess | - self garbageCollectMost <=3D self lowSpaceThreshold - ifTrue: [self garbageCollect <=3D self lowSpaceThreshold - ifTrue: ["free space must be above threshold before - starting low space watcher" - ^ Beeper beep]]. -=20 - Smalltalk specialObjectsArray at: 23 put: nil. "process causing low space= will be saved here" - LowSpaceSemaphore :=3D Semaphore new. - self primLowSpaceSemaphore: LowSpaceSemaphore. - self primSignalAtBytesLeft: self lowSpaceThreshold. "enable low space int= errupts" -=20 - LowSpaceSemaphore wait. "wait for a low space condition..." -=20 - self primSignalAtBytesLeft: 0. "disable low space interrupts" - self primLowSpaceSemaphore: nil. - LowSpaceProcess :=3D nil. -=20 - "The process that was active at the time of the low space interrupt." - preemptedProcess :=3D (Smalltalk specialObjectsArray at: 23) - ifNil: [Processor preemptedProcess "if in-image signal of OutOfMemory"]. - Smalltalk specialObjectsArray at: 23 put: nil. -=20 - "Note: user now unprotected until the low space watcher is re-installed" -=20 - self memoryHogs isEmpty - ifFalse: [free :=3D self bytesLeft. - self memoryHogs - do: [ :hog | hog freeSomeSpace ]. - self bytesLeft > free - ifTrue: [ ^ self installLowSpaceWatcher ]]. -=20 - Preferences logDebuggerStackToFile ifTrue: [ - self - logError: 'Space is low' - inContext: preemptedProcess suspendedContext - to: 'LowSpaceDebug.log']. - =09 - Project current - interruptName: 'Space is low' - message: self lowSpaceChoices - preemptedProcess: preemptedProcess - ! Item was changed: ----- Method: SmalltalkImage>>lowSpaceWatcherProcess (in category 'memory s= pace') ----- lowSpaceWatcherProcess + ^LowSpaceWatcher default ifNotNil: [ :watcher | watcher lowSpaceWatcherPr= ocess ]! - ^LowSpaceProcess! Item was removed: - ----- Method: SmalltalkImage>>memoryHogs (in category 'memory space') ----- - memoryHogs - "Answer the list of objects to notify with #freeSomeSpace if memory gets f= ull." -=20 - ^ MemoryHogs ifNil: [MemoryHogs :=3D OrderedCollection new]! Item was removed: - ----- Method: SmalltalkImage>>primLowSpaceSemaphore: (in category 'memory s= pace') ----- - primLowSpaceSemaphore: aSemaphore - "Primitive. Register the given Semaphore to be signalled when the - number of free bytes drops below some threshold. Disable low-space - interrupts if the argument is nil." -=20 - - self primitiveFailed! Item was removed: - ----- Method: SmalltalkImage>>primSignalAtBytesLeft: (in category 'memory s= pace') ----- - primSignalAtBytesLeft: numBytes - "Tell the interpreter the low-space threshold in bytes. When the free - space falls below this threshold, the interpreter will signal the low-space - semaphore, if one has been registered. Disable low-space interrupts if the - argument is zero. Fail if numBytes is not an Integer." -=20 - - self primitiveFailed! Item was removed: - ----- Method: SmalltalkImage>>signalLowSpace (in category 'memory space') -= ---- - signalLowSpace - "Signal the low-space semaphore to alert the user that space is running lo= w." -=20 - LowSpaceSemaphore signal.! --===============3139290554838361321==-- From commits@source.squeak.org Sun Feb 18 16:31:18 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Treated Inbox: System-jar.1446.mcz Date: Sun, 18 Feb 2024 16:31:07 +0000 Message-ID: <20240218163116.3D64F583D4D@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============9146422898813953709==" --===============9146422898813953709== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable David T. Lewis uploaded a new version of System to project The Treated Inbox: http://source.squeak.org/treated/System-jar.1446.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: System-jar.1446 Author: jar Time: 29 January 2024, 1:41:28.399781 pm UUID: fafea975-15ff-a94d-8bfc-a3c9feb44c78 Ancestors: System-dtl.1445 For discussion: A small modification of System-dtl.1445 to address the possib= ilty of two low space watcher processes running simultaneously if you run thi= s example: [LowSpaceWatcher install] fork. [LowSpaceWatcher install] fork It's a contrived example but a real situation of this kind happened to me dur= ing my work on #terminate and confused me a great deal. In the current image = the situation most likely can't happen by itself.=20 If the low space watches is supposed to be a singleton then, for the sake of = consistency, I'd vote for making sure the low space watcher can't start two p= rocesses concurrently. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against System-dtl.1445 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: Object subclass: #LowSpaceWatcher + instanceVariableNames: 'lowSpaceProcess lowSpaceSemaphore lowSpaceAccessPr= otect' - instanceVariableNames: 'lowSpaceProcess lowSpaceSemaphore' classVariableNames: 'Default MemoryHogs' poolDictionaries: '' category: 'System-Support'! =20 !LowSpaceWatcher commentStamp: 'dtl 1/28/2024 17:56' prior: 0! LowSpaceWatcher is responsible for responding to a notification from the vi= rtual machine that memory is low and that it (the VM) may soon be unable to s= upport additional object memory allocations. A single default instance for th= e image manages both the low space semaphore and the process that waits on th= e semaphore to handle low space conditions. When the low space watcher is not= ified that memory is low, it attempts to identify the process likely associat= ed with the low space condition and to provide a notifier to allow the proble= m condition to be corrected. =20 If a low space condition is detected in the virtual machine, the low space = semaphore is signalled either directly by the VM or indirectly through an Out= OfMemory error following a failed primitive invocation. The VM is responsible= for identifying low space conditions, and its behavior will vary depending o= n both the VM implementation and the memory system of the underlying platform= operating system. In particular, on a virtual machine operating system the V= M may continue to receive memory allocations from the operating system while = the operating system attempts to support the memory requests by increased swa= pping to disk. Under these conditions, the low space semaphore may not be sig= nalled because system memory still appears to be available, even though perfo= rmance is severely degraded due to swapping. =20 The VM may provide control of its memory usage, typically through command l= ine parameters or VM parameters that can be set from the image. These paramet= ers will affect when and if the low space watcher is signalled by the VM. =20 A registry is maintained in class variable MemoryHogs to identify objects (= classes) know how to release unneeded memory when sent the message #freeSomeS= pace. The low space watcher process will send this message when a low spaced = condition is encountered. =20 To signal the low space watcher and simulate a low space condition, evaluat= e "LowSpaceWatcher default signalLowSpace".! Item was changed: ----- Method: LowSpaceWatcher class>>install (in category 'instance creatio= n') ----- install "Start a process to watch for low-space conditions." "Smalltalk installLowSpaceWatcher" =20 + self default lowSpaceAccessProtect critical: [self default stop; start] if= Locked: [] - self default stop; start -=20 ! Item was added: + ----- Method: LowSpaceWatcher>>lowSpaceAccessProtect (in category 'process'= ) ----- + lowSpaceAccessProtect +=20 + ^lowSpaceAccessProtect ifNil: [lowSpaceAccessProtect :=3D Mutex new]! --===============9146422898813953709==-- From commits@source.squeak.org Sun Feb 18 16:31:35 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Treated Inbox: System-dtl.1446.mcz Date: Sun, 18 Feb 2024 16:31:29 +0000 Message-ID: <20240218163132.DB2C45826EA@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1874550501229190313==" --===============1874550501229190313== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable David T. Lewis uploaded a new version of System to project The Treated Inbox: http://source.squeak.org/treated/System-dtl.1446.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: System-dtl.1446 Author: dtl Time: 30 January 2024, 4:35:00.140218 pm UUID: cede9a72-39dd-4d82-91ba-9e60fe24a06a Ancestors: System-dtl.1445 Split lowSpaceWatcher into smaller methods with comments to explain each step= in the low space handling process. HelpBrowser openOn: LowSpaceWatcher. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against System-dtl.1445 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: LowSpaceWatcher>>disableVirtualMachineNotifications (in categ= ory 'process steps') ----- + disableVirtualMachineNotifications + "Ask the virtual machine to stop sending low space interrupts, and forget = the current semaphore and watcher process." +=20 + self primSignalAtBytesLeft: 0. "disable low space interrupts" + self primLowSpaceSemaphore: nil. + lowSpaceProcess :=3D nil. + ! Item was added: + ----- Method: LowSpaceWatcher>>findPreemptedProcess (in category 'process s= teps') ----- + findPreemptedProcess + "Find the process that was active at the time of the low space interrupt. = Check + first if the virtual machine has recorded the process that was active at t= he time + that it detected the low space detection, otherwise answer the process tha= t was + most recently preempted when the semaphore was signalled." +=20 + | preemptedProcess | + preemptedProcess :=3D (Smalltalk specialObjectsArray at: 23) + ifNil: [Processor preemptedProcess "if in-image signal of OutOfMemory"]. + Smalltalk specialObjectsArray at: 23 put: nil. + ^ preemptedProcess +=20 + ! Item was added: + ----- Method: LowSpaceWatcher>>handleLowSpaceCondition (in category 'proces= s steps') ----- + handleLowSpaceCondition + "A low space condition has been detected. Do whatever may be necessary to = free + some memory in the image before proceeding." +=20 + | preemptedProcess | + preemptedProcess :=3D self findPreemptedProcess. + self notifyMemoryHogs ifFalse: [ + self logError: preemptedProcess. + self notifyUser: preemptedProcess ]. +=20 + ! Item was added: + ----- Method: LowSpaceWatcher>>initializeVirtualMachineNotifications (in ca= tegory 'process steps') ----- + initializeVirtualMachineNotifications + "Let the virtual machine know how to notify the image of low space conditi= ons." +=20 + Smalltalk specialObjectsArray at: 23 put: nil. "process causing low space= will be saved here" + lowSpaceSemaphore :=3D Semaphore new. + self primLowSpaceSemaphore: lowSpaceSemaphore. + self primSignalAtBytesLeft: Smalltalk lowSpaceThreshold. "enable low spac= e interrupts" + ! Item was added: + ----- Method: LowSpaceWatcher>>logError: (in category 'process steps') ----- + logError: preemptedProcess +=20 + Preferences logDebuggerStackToFile ifTrue: [ + Smalltalk + logError: 'Space is low' + inContext: preemptedProcess suspendedContext + to: 'LowSpaceDebug.log' ]. + ! Item was changed: ----- Method: LowSpaceWatcher>>lowSpaceWatcher (in category 'process') ----- lowSpaceWatcher + "Wait until the low space semaphore is signalled, then take appropriate ac= tions. This + method is run once in the low space watcher process. Before terminating, i= t schedules + a new process to handle the next low space condition." - "Wait until the low space semaphore is signalled, then take appropriate ac= tions." =20 + self safeToInstall ifFalse: [ ^ Beeper beep]. + self initializeVirtualMachineNotifications. + lowSpaceSemaphore wait. + self disableVirtualMachineNotifications; handleLowSpaceCondition. + self start. "schedule a new process to handle the next low space condition" - | free preemptedProcess | - Smalltalk garbageCollectMost <=3D Smalltalk lowSpaceThreshold - ifTrue: [self garbageCollect <=3D Smalltalk lowSpaceThreshold - ifTrue: ["free space must be above threshold before - starting low space watcher" - ^ Beeper beep]]. =20 - Smalltalk specialObjectsArray at: 23 put: nil. "process causing low space= will be saved here" - lowSpaceSemaphore :=3D Semaphore new. - self primLowSpaceSemaphore: lowSpaceSemaphore. - self primSignalAtBytesLeft: Smalltalk lowSpaceThreshold. "enable low spac= e interrupts" -=20 - lowSpaceSemaphore wait. "wait for a low space condition..." -=20 - self primSignalAtBytesLeft: 0. "disable low space interrupts" - self primLowSpaceSemaphore: nil. - lowSpaceProcess :=3D nil. -=20 - "The process that was active at the time of the low space interrupt." - preemptedProcess :=3D (Smalltalk specialObjectsArray at: 23) - ifNil: [Processor preemptedProcess "if in-image signal of OutOfMemory"]. - Smalltalk specialObjectsArray at: 23 put: nil. -=20 - "Note: user now unprotected until the low space watcher is re-installed" -=20 - self memoryHogs isEmpty - ifFalse: [free :=3D Smalltalk bytesLeft. - self memoryHogs - do: [ :hog | hog freeSomeSpace ]. - self bytesLeft > free - ifTrue: [ ^ LowSpaceWatcher installLowSpaceWatcher ]]. -=20 - Preferences logDebuggerStackToFile ifTrue: [ - self - logError: 'Space is low' - inContext: preemptedProcess suspendedContext - to: 'LowSpaceDebug.log']. - =09 - Project current - interruptName: 'Space is low' - message: self lowSpaceChoices - preemptedProcess: preemptedProcess ! Item was added: + ----- Method: LowSpaceWatcher>>notifyMemoryHogs (in category 'process steps= ') ----- + notifyMemoryHogs + "Try to clean up memory hogs. Answer true if sufficient memory was release= d." +=20 + | free | + self memoryHogs isEmpty + ifTrue: [ ^ false ] + ifFalse: [ free :=3D Smalltalk bytesLeft. + self memoryHogs + do: [ :hog | hog freeSomeSpace ]. + ^ Smalltalk bytesLeft > free ] +=20 + ! Item was added: + ----- Method: LowSpaceWatcher>>notifyUser: (in category 'process steps') --= --- + notifyUser: preemptedProcess + "Interrupt the user to allow the low space condition to be corrected. The = user + is now unprotected until the low space watcher is re-installed." +=20 + Project current + interruptName: 'Space is low' + message: self lowSpaceChoices + preemptedProcess: preemptedProcess. + ! Item was added: + ----- Method: LowSpaceWatcher>>safeToInstall (in category 'process steps') = ----- + safeToInstall + "Free space must be above threshold before starting low space watcher" +=20 + Smalltalk garbageCollectMost > Smalltalk lowSpaceThreshold + ifFalse: [ ^ Smalltalk garbageCollect > Smalltalk lowSpaceThreshold ]. + ^ true + ! Item was changed: ----- Method: LowSpaceWatcher>>start (in category 'initialize-release') ---= -- start "Start a new low space watcher process that will register a semaphore with= the virtual machine and wait for the semaphore to be signalled if a low space = condition is detected." =20 + lowSpaceProcess :=3D [self lowSpaceWatcher] forkAt: Processor lowIOPriorit= y. - lowSpaceProcess :=3D [self lowSpaceWatcher] newProcess. - lowSpaceProcess priority: Processor lowIOPriority. - lowSpaceProcess resume. ! --===============1874550501229190313==-- From commits@source.squeak.org Sun Feb 18 21:42:11 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Treated Inbox: System-jar.1367.mcz Date: Sun, 18 Feb 2024 21:42:06 +0000 Message-ID: <20240218214209.895FF5826E6@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0781776877357199330==" --===============0781776877357199330== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable David T. Lewis uploaded a new version of System to project The Treated Inbox: http://source.squeak.org/treated/System-jar.1367.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: System-jar.1367 Author: jar Time: 11 July 2022, 1:21:36.615972 pm UUID: 403676fc-9569-c542-ae88-f17030bb70c5 Ancestors: System-mt.1366 protect LowSpaceWatcher against concurrent invocations Currently #installLowSpaceWatcher runs unprotected against multiple concurren= t invocations; try to run this example in the Workspace: p1 :=3D [Smalltalk installLowSpaceWatcher] fork. p2 :=3D [Smalltalk installLowSpaceWatcher] fork Expected behavior is that the LowSpaceWatcher gets reinstalled twice in a row= ; what's happening now is both invocations will run concurrently, both will b= lock in terminate and then install two LowSpaceWatchers (actually, at the mom= ent there's a little bug in terminate so the concurrent invocations will end = up with one process stuck at a semaphore but that's about to be fixed soon) Alternatively, this could be fixed by running #installLowSpaceWatcher's code = as a critical section but that would mean a new class variable which may not = be entirely justifiable - but let me know if #critical would be preferable. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against System-mt.1366 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: SmalltalkImage>>installLowSpaceWatcher (in category 'memory s= pace') ----- installLowSpaceWatcher "Start a process to watch for low-space conditions." "Smalltalk installLowSpaceWatcher" + =09 + "Run with the highest priority to avoid concurrency issues. + Workspce example: + p1 :=3D [Smalltalk installLowSpaceWatcher] fork.=20 + p2 :=3D [Smalltalk installLowSpaceWatcher] fork + Here both proceses are scheduled in the run queue, then p1 wakes up, start= s the LowSpaceProcess=20 + termination and waits on a semaphore until the termination is finished. Be= fore the LowSpaceProcess + can proceed, process p2 wakes up and starts the LowSpaceProcess terminatio= n just like p1 and waits + on a semaphore until the termination is finished. Finally the LowSpaceProc= ess wakes up, unwinds,=20 + unblocks p1 a p2 and terminates. p1 now continues and installs a new LowSp= aceProcess and then=20 + p2 does the same. The result will be two processes running the #lowSpaceWa= tcher method. + Please note this describes the behavior in Squeak 6 using direct process t= ermination; see #terminate." =20 + [ + self primSignalAtBytesLeft: 0. "disable low-space interrupts" + LowSpaceProcess =3D=3D nil ifFalse: [LowSpaceProcess terminate]. + LowSpaceProcess :=3D [self lowSpaceWatcher] newProcess. + LowSpaceProcess priority: Processor lowIOPriority. + LowSpaceProcess resume + ] valueUnpreemptively! - self primSignalAtBytesLeft: 0. "disable low-space interrupts" - LowSpaceProcess =3D=3D nil ifFalse: [LowSpaceProcess terminate]. - LowSpaceProcess :=3D [self lowSpaceWatcher] newProcess. - LowSpaceProcess priority: Processor lowIOPriority. - LowSpaceProcess resume. -=20 - ! --===============0781776877357199330==-- From commits@source.squeak.org Sun Feb 18 23:18:39 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: CollectionsTests-cmm.404.mcz Date: Sun, 18 Feb 2024 23:18:34 +0000 Message-ID: <20240218231837.C57AC582735@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5339229823459161239==" --===============5339229823459161239== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Chris Muller uploaded a new version of CollectionsTests to project The Trunk: http://source.squeak.org/trunk/CollectionsTests-cmm.404.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: CollectionsTests-cmm.404 Author: cmm Time: 18 February 2024, 5:18:33.048788 pm UUID: 1a56870d-c708-4750-bf4b-165435161a68 Ancestors: CollectionsTests-mt.403 Test #peek: with a negative argument. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against CollectionsTests-m= t.403 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: ReadStreamTest>>testPeeks (in category 'tests - accessing') -= ---- testPeeks | stream | stream :=3D self streamOnArray. =09 self assert: (stream peek: 0) =3D #(). self assert: (stream peek: 1) =3D #(1). self assert: (stream peek: 3) =3D #(1 (a b c) false). self assert: (stream peek: 4) =3D #(1 (a b c) false). =09 stream next. +=20 + self assert: (stream peek: -1) =3D #(1). - =09 self assert: (stream peek: 0) =3D #(). self assert: (stream peek: 1) =3D #((a b c)). self assert: (stream peek: 3) =3D #((a b c) false).! --===============5339229823459161239==-- From commits@source.squeak.org Sun Feb 18 23:19:12 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Collections-cmm.1059.mcz Date: Sun, 18 Feb 2024 23:19:06 +0000 Message-ID: <20240218231910.6A6B6583E18@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6779069238293859967==" --===============6779069238293859967== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Chris Muller uploaded a new version of Collections to project The Trunk: http://source.squeak.org/trunk/Collections-cmm.1059.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Collections-cmm.1059 Author: cmm Time: 18 February 2024, 5:19:05.159381 pm UUID: 982eb6aa-f237-4e79-a208-ae6b2f23cf1b Ancestors: Collections-mt.1058 - Let #peek: support a negative number of characters to peekBack:. - Let SharedQueue2 support #atEnd. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Collections-mt.105= 8 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: PositionableStream>>peek: (in category 'accessing') ----- + peek: anInteger=20 + ^ anInteger positive + ifTrue: [ self peekForward: anInteger ] + ifFalse: [ self peekBack: anInteger abs ]! - peek: anInteger - "Answer what would be returned if the message next: anInteger were sent to= the receiver. If the receiver has less than anInteger more elements, only an= swer so many elements as available." -=20 - | oldPosition result | - oldPosition :=3D position. - result :=3D self next: anInteger. - position :=3D oldPosition. - ^ result! Item was added: + ----- Method: PositionableStream>>peekBack: (in category 'accessing') ----- + peekBack: anInteger=20 + "Answer anInteger characters previous to the current position, or all to t= he beginning, whichever is fewer." + ^ anInteger negative + ifTrue: [ self peek: anInteger negated ] + ifFalse: + [ | toSkip | toSkip :=3D anInteger min: self position. + self + skip: toSkip negated ; + next: toSkip ]! Item was added: + ----- Method: PositionableStream>>peekForward: (in category 'accessing') --= --- + peekForward: anInteger + "Answer what would be returned if the message next: anInteger were sent= to the receiver. If the receiver is at the end, answer an empty string." + | priorPos result | + priorPos :=3D position. + result :=3D self next: anInteger. + position :=3D priorPos. + ^ result! Item was added: + ----- Method: SharedQueue2>>atEnd (in category 'testing') ----- + atEnd + ^ monitor critical: [ items isEmpty ]! --===============6779069238293859967==-- From commits@source.squeak.org Sun Feb 18 23:22:40 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: CollectionsTests-cmm.405.mcz Date: Sun, 18 Feb 2024 23:22:36 +0000 Message-ID: <20240218232239.31BEB582735@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1105730974391032582==" --===============1105730974391032582== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Chris Muller uploaded a new version of CollectionsTests to project The Trunk: http://source.squeak.org/trunk/CollectionsTests-cmm.405.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: CollectionsTests-cmm.405 Author: cmm Time: 18 February 2024, 5:22:35.213846 pm UUID: fa6e9709-7f5a-4781-b197-45bd9a9e1414 Ancestors: CollectionsTests-cmm.404 Include, in #testPeeks, the cases where the argument overshoots the bounds of= the underlying stream, in either direction. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against CollectionsTests-c= mm.404 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: ReadStreamTest>>testPeeks (in category 'tests - accessing') -= ---- testPeeks | stream | stream :=3D self streamOnArray. =09 self assert: (stream peek: 0) =3D #(). self assert: (stream peek: 1) =3D #(1). self assert: (stream peek: 3) =3D #(1 (a b c) false). self assert: (stream peek: 4) =3D #(1 (a b c) false). =09 stream next. =20 self assert: (stream peek: -1) =3D #(1). + self assert: (stream peek: -99) =3D #(1). self assert: (stream peek: 0) =3D #(). self assert: (stream peek: 1) =3D #((a b c)). + self assert: (stream peek: 3) =3D #((a b c) false). + self assert: (stream peek: 99) =3D #((a b c) false)! - self assert: (stream peek: 3) =3D #((a b c) false).! --===============1105730974391032582==-- From commits@source.squeak.org Mon Feb 19 00:01:57 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: JSON-cmm.61.mcz Date: Mon, 19 Feb 2024 00:01:51 +0000 Message-ID: <20240219000155.22FC8583D4C@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5998531942970418278==" --===============5998531942970418278== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Chris Muller uploaded a new version of JSON to project The Trunk: http://source.squeak.org/trunk/JSON-cmm.61.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: JSON-cmm.61 Author: cmm Time: 18 February 2024, 6:01:50.22946 pm UUID: 9f100ce1-3d3c-4ea2-b975-4821175b41ba Ancestors: JSON-ct.58 Path access and enumeration for JSON objects. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against JSON-ct.58 =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: Collection>>atPath: (in category '*json') ----- + atPath: anArray=20 + "Assume I'm a set of nested HashedCollections and/or SequenceableCollectio= ns. Answer the object at the path of indices and/or keys identified in anArr= ay." + ^ self + atPath: anArray + ifLost: [ : last | self error: 'path lost after' , last asString ]! Item was added: + ----- Method: Collection>>atPath:ifLost: (in category '*json') ----- + atPath: anArray ifLost: aBlock + "Assume I'm a set of nested HashedCollections and/or SequenceableCollectio= ns. Answer the object at the path of indices and/or keys identified in anArr= ay. If the full path specified by anArray isn't present, cull aBlock with th= e last element present along the path." + | last | + ^ (self + path: anArray + do: [ : elem : node | last :=3D node ]) + ifNil: [ aBlock cull: last ] + ifNotNil: [ last ]! Item was added: + ----- Method: Collection>>path:do: (in category '*json') ----- + path: anArray do: aBlock=20 + "Assume I'm a set of nested HashedCollections and/or SequenceableCollectio= ns. Value aBlock with each object along the path of indices and/or keys iden= tified in anArray. If a path element isn't found, stop, and return nil, othe= rwise, return self." + anArray + inject: self + into: + [ : dictOrArray : pathElem | dictOrArray + at: pathElem + ifPresent: [ : node | aBlock value: pathElem value: node ] + ifAbsent: [ ^ nil ] ]. + ^ self! --===============5998531942970418278==-- From commits@source.squeak.org Mon Feb 19 00:05:29 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: System-cmm.1447.mcz Date: Mon, 19 Feb 2024 00:05:23 +0000 Message-ID: <20240219000526.EA1E4583DE2@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1871452595618397575==" --===============1871452595618397575== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Chris Muller uploaded a new version of System to project The Trunk: http://source.squeak.org/trunk/System-cmm.1447.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: System-cmm.1447 Author: cmm Time: 12 February 2024, 3:06:16.671515 pm UUID: 03b7d234-da01-4b78-94c0-f78c01d4afe0 Ancestors: System-codefrau.1446 FileStream's stdout and stderr are for Linux, so use Linux line-endings when = writing to them. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against System-codefrau.14= 46 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: CodeLoader>>installSourceFile: (in category 'installing') ---= -- installSourceFile: aStream "Install the previously loaded source file" | contents trusted | aStream ifNil:[^self error:'No content to install']. trusted :=3D SecurityManager default positionToSecureContentsOf: aStream. trusted ifFalse:[(SecurityManager default enterRestrictedMode)=20 ifFalse:[ aStream close. ^ self error:'Insecure content encountered']]. contents :=3D self allButShebangLine: aStream upToEnd unzipped asString. (aStream respondsTo: #close) ifTrue:[aStream close]. ^[contents readStream fileIn]=20 on: SyntaxErrorNotification=20 do: [ : err | Smalltalk isHeadless ifTrue:=20 + [FileStream stdout nextPutAll: err errorCode; lf; flush. - [FileStream stdout nextPutAll: err errorCode; cr; flush. Smalltalk snapshot: false andQuit: true ] ifFalse: [err pass] ]! Item was changed: ----- Method: Exception>>printVerboseOn: (in category '*system') ----- printVerboseOn: aStream=20 aStream nextPutAll: 'vvvvvvvvvvvvvvvvvv ' , self description , ' vvvvvvvvvvvvvvvv= vv' ; + lf ; - cr ; nextPutAll: 'The time is ', DateAndTime now asString ; + lf. - cr. "Allow applications to optionally print extra details without overriding a= base package." self printDetailsOn: aStream. aStream nextPutAll: self signalerContext longStack ; + lf ; - cr ; nextPutAll: '^^^^^^^^^^^^^^^^^^ ' , self description , ' ^^^^^^^^^^^^^^^^= ^^' ; + lf ; - cr ; flush! Item was changed: ----- Method: SmalltalkImage>>run: (in category 'command line') ----- run: aBlock [ [ self patchSystem. (aBlock numArgs =3D 1 and: [ self arguments size > 1 ]) ifTrue: [ "Allow a large, variable number of arguments to be passed as an= Array to aBlock." aBlock value: self arguments ] ifFalse: [ aBlock valueWithEnoughArguments: self arguments ] ] on: SyntaxErrorNotification do: [ : err | FileStream stdout nextPutAll: err errorCode ; + lf; flush. - cr; flush. self isHeadless ifTrue: [ self snapshot: false andQuit: true ] ifFalse: [ err pass ] ] on: Error , ProvideAnswerNotification do: [ : err | err printVerboseOn: FileStream stderr. FileStream stderr flush. self isHeadless ifTrue: [ self snapshot: false andQuit: true ] ifFalse: [ err pass ] ] on: ProgressInitiationException do: [ : pie | "Don't want to log this Notification." pie defaultAction ] ] on: Notification , Warning do: [ : noti | FileStream stdout nextPutAll: DateAndTime now asString ; space ; nextPutAll: noti description ; + lf. - cr. noti resume ] ! --===============1871452595618397575==-- From commits@source.squeak.org Mon Feb 19 07:00:37 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Monticello-cmm.807.mcz Date: Mon, 19 Feb 2024 07:00:31 +0000 Message-ID: <20240219070036.194055826B9@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7086831071304565809==" --===============7086831071304565809== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Chris Muller uploaded a new version of Monticello to project The Trunk: http://source.squeak.org/trunk/Monticello-cmm.807.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Monticello-cmm.807 Author: cmm Time: 19 February 2024, 1:00:29.476937 am UUID: ea4dc7e6-5232-4e81-88f5-796f49140bf7 Ancestors: Monticello-eem.806 Fixed the confirmation message associated with the 'copy image versions here'= function on the Repository menu. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Monticello-eem.806= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: MCRepository>>copyImageVersions (in category 'versions') ----- copyImageVersions "For each package contained in the receiver, copy the version of that pack= age which is currently loaded in this image. If no version of a package is l= oaded in the image, nothing is copied for that package." MCRepository trunk =3D self ifTrue: [^ self error: 'Must not copy over to = Trunk repository' translated]. MCRepository inbox =3D self ifTrue: [^ self error: 'Must not copy over to = Inbox repository' translated]. MCRepository treated =3D self ifTrue: [^ self error: 'Must not copy over t= o Treated repository' translated]. self cacheAllFileNamesDuring: + [ self newerImageVersions do: [ : each | self storeVersion: each ] ]! - [ self allPackageNames do: - [ : eachPkgName | MCWorkingCopy allManagers - detect: [ : each | each packageName =3D eachPkgName ] - ifFound: - [ : loaded | loaded ancestors do: - [ : infoToCopy | (self includesVersionNamed: infoToCopy versionName) = ifFalse: - [ (MCRepositoryGroup default versionWithInfo: infoToCopy) - ifNil: [ Warning signal: infoToCopy name , ' not found in Repositor= yGroup default.' ] - ifNotNil: - [ : ver | self storeVersion: ver ] ] ] ] - ifNone: [ "Image specifies no version to copy." ] ] ]! Item was added: + ----- Method: MCRepository>>newerImageVersions (in category 'private') ----- + newerImageVersions + ^ Array streamContents: + [ : stream | self allPackageNames do: + [ : eachPkgName | MCWorkingCopy allManagers + detect: [ : each | each packageName =3D eachPkgName ] + ifFound: + [ : loaded | loaded ancestors do: + [ : infoToCopy | (self includesVersionNamed: infoToCopy versionName) = ifFalse: + [ (MCRepositoryGroup default versionWithInfo: infoToCopy) + ifNil: [ Warning signal: infoToCopy name , ' not found in Repositor= yGroup default.' ] + ifNotNil: + [ : ver | stream nextPut: ver ] ] ] ] + ifNone: [ "Image specifies no version to copy." ] ] ]! Item was changed: ----- Method: MCWorkingCopyBrowser>>copyImageVersionsSafely (in category 'a= ctions') ----- copyImageVersionsSafely + self repository newerImageVersions + ifEmpty: [ Project current uiManager inform: 'Repository up to date.' ] + ifNotEmpty: + [ : imageVersions | | msg | + msg :=3D String streamContents: + [ : stream | imageVersions do: + [ : each | stream cr ; + nextPutAll: each info name ; nextPut: $,]. + stream cr ; + cr ; + nextPutAll: ' will be copied to {1}?' ]. + (Project current uiManager + confirm: (msg translated format: {self repository description}) asTextF= romHtml + title: 'Copy Versions' translated) ifFalse: [ ^ self ]. + self copyImageVersions ]! - (Project uiManager confirm: ('Do you really want to copy the loaded versio= n of each of {1} packages to {2}?' translated asTextFromHtml fo= rmat: {MCWorkingCopy allManagers size. self repository description}) title: '= Copy Image Versions' translated) ifFalse: [^ self]. - self copyImageVersions.! --===============7086831071304565809==-- From commits@source.squeak.org Thu Feb 22 00:14:55 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: System-dtl.1448.mcz Date: Thu, 22 Feb 2024 00:14:46 +0000 Message-ID: <20240222001452.B20F05826A9@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3344218382063454111==" --===============3344218382063454111== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable David T. Lewis uploaded a new version of System to project The Trunk: http://source.squeak.org/trunk/System-dtl.1448.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: System-dtl.1448 Author: dtl Time: 21 February 2024, 7:08:38.598872 pm UUID: 109c5158-c1b6-4b7b-891a-380b5b9ee3de Ancestors: System-cmm.1447 Move the low space watcher from SmalltalkImage to new class LowSpaceWatcher h= aving a singleton with responsibility for the low space semaphore and low spa= ce watcher process. Add class and method comments and split lowSpaceWatcher i= nto smaller methods to clarify steps in the process. Add #registerCleaner for= adding savvy memory hogs to the memory hog registry. For organization and do= cumentation only, no functional change to the low space watcher or memory pol= icies. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against System-cmm.1447 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + Object subclass: #LowSpaceWatcher + instanceVariableNames: 'lowSpaceProcess lowSpaceSemaphore' + classVariableNames: 'Default MemoryHogs' + poolDictionaries: '' + category: 'System-Support'! +=20 + !LowSpaceWatcher commentStamp: 'dtl 1/28/2024 17:56' prior: 0! + LowSpaceWatcher is responsible for responding to a notification from the vi= rtual machine that memory is low and that it (the VM) may soon be unable to s= upport additional object memory allocations. A single default instance for th= e image manages both the low space semaphore and the process that waits on th= e semaphore to handle low space conditions. When the low space watcher is not= ified that memory is low, it attempts to identify the process likely associat= ed with the low space condition and to provide a notifier to allow the proble= m condition to be corrected. +=20 + If a low space condition is detected in the virtual machine, the low space = semaphore is signalled either directly by the VM or indirectly through an Out= OfMemory error following a failed primitive invocation. The VM is responsible= for identifying low space conditions, and its behavior will vary depending o= n both the VM implementation and the memory system of the underlying platform= operating system. In particular, on a virtual machine operating system the V= M may continue to receive memory allocations from the operating system while = the operating system attempts to support the memory requests by increased swa= pping to disk. Under these conditions, the low space semaphore may not be sig= nalled because system memory still appears to be available, even though perfo= rmance is severely degraded due to swapping. +=20 + The VM may provide control of its memory usage, typically through command l= ine parameters or VM parameters that can be set from the image. These paramet= ers will affect when and if the low space watcher is signalled by the VM. +=20 + A registry is maintained in class variable MemoryHogs to identify objects (= classes) know how to release unneeded memory when sent the message #freeSomeS= pace. The low space watcher process will send this message when a low spaced = condition is encountered. +=20 + To signal the low space watcher and simulate a low space condition, evaluat= e "LowSpaceWatcher default signalLowSpace".! Item was added: + ----- Method: LowSpaceWatcher class>>default (in category 'instance creatio= n') ----- + default + "The singleton low space watcher." +=20 + ^ Default ifNil: [ Default :=3D self new start ] + ! Item was added: + ----- Method: LowSpaceWatcher class>>install (in category 'instance creatio= n') ----- + install + "Start a process to watch for low-space conditions." + "Smalltalk installLowSpaceWatcher" +=20 + self default stop; start +=20 + ! Item was added: + ----- Method: LowSpaceWatcher class>>registerCleaner: (in category 'memory = hog registry') ----- + registerCleaner: memoryCleaner + "Add memoryCleaner to the MemoryHog list where memoryCleaner is an object = or class that responds to #freeSomeSpace." +=20 + (memoryCleaner respondsTo: #freeSomeSpace) + ifFalse: [ ^ self error: memoryCleaner asString, ' does not understand #f= reeSomeSpace' ]. + (self default memoryHogs includes: memoryCleaner) + ifFalse: [ MemoryHogs add: memoryCleaner ].! Item was added: + ----- Method: LowSpaceWatcher class>>signalLowSpace (in category 'signal lo= w space') ----- + signalLowSpace + "Signal the low-space semaphore to alert the user that space is running lo= w." +=20 + ^ self default signalLowSpace.! Item was added: + ----- Method: LowSpaceWatcher>>disableVirtualMachineNotifications (in categ= ory 'process steps') ----- + disableVirtualMachineNotifications + "Ask the virtual machine to stop sending low space interrupts, and forget = the current semaphore and watcher process." +=20 + self primSignalAtBytesLeft: 0. "disable low space interrupts" + self primLowSpaceSemaphore: nil. + lowSpaceProcess :=3D nil. + ! Item was added: + ----- Method: LowSpaceWatcher>>findPreemptedProcess (in category 'process s= teps') ----- + findPreemptedProcess + "Find the process that was active at the time of the low space interrupt. = Check + first if the virtual machine has recorded the process that was active at t= he time + that it detected the low space detection, otherwise answer the process tha= t was + most recently preempted when the semaphore was signalled." +=20 + | preemptedProcess | + preemptedProcess :=3D (Smalltalk specialObjectsArray at: 23) + ifNil: [Processor preemptedProcess "if in-image signal of OutOfMemory"]. + Smalltalk specialObjectsArray at: 23 put: nil. + ^ preemptedProcess +=20 + ! Item was added: + ----- Method: LowSpaceWatcher>>handleLowSpaceCondition (in category 'proces= s') ----- + handleLowSpaceCondition + "A low space condition has been detected. Do whatever may be necessary to = free + some memory in the image before proceeding." +=20 + | preemptedProcess | + preemptedProcess :=3D self findPreemptedProcess. + self notifyMemoryHogs ifFalse: [ + self logError: preemptedProcess. + self notifyUser: preemptedProcess ]. +=20 + ! Item was added: + ----- Method: LowSpaceWatcher>>initializeVirtualMachineNotifications (in ca= tegory 'process steps') ----- + initializeVirtualMachineNotifications + "Let the virtual machine know how to notify the image of low space conditi= ons." +=20 + Smalltalk specialObjectsArray at: 23 put: nil. "process causing low space= will be saved here" + lowSpaceSemaphore :=3D Semaphore new. + self primLowSpaceSemaphore: lowSpaceSemaphore. + self primSignalAtBytesLeft: Smalltalk lowSpaceThreshold. "enable low spac= e interrupts" + ! Item was added: + ----- Method: LowSpaceWatcher>>logError: (in category 'process steps') ----- + logError: preemptedProcess +=20 + Preferences logDebuggerStackToFile ifTrue: [ + Smalltalk + logError: 'Space is low' + inContext: preemptedProcess suspendedContext + to: 'LowSpaceDebug.log' ]. + ! Item was added: + ----- Method: LowSpaceWatcher>>lowSpaceChoices (in category 'memory space')= ----- + lowSpaceChoices + "Return a notifier message string to be presented when space is running lo= w." +=20 + ^ 'Warning!! Squeak is almost out of memory!! +=20 + Low space detection is now disabled. It will be restored when you close or = proceed from this error notifier. Don''t panic, but do proceed with caution. +=20 + Here are some suggestions: +=20 + If you suspect an infinite recursion (the same methods calling each other = again and again), then close this debugger, and fix the problem. +=20 + If you want this computation to finish, then make more space available (re= ad on) and choose "proceed" in this debugger. Here are some ways to make more= space available... + > Close any windows that are not needed. + > Get rid of some large objects (e.g., images). + > Leave this window on the screen, choose "save as..." from the screen m= enu, quit, restart the Squeak VM with a larger memory allocation, then restar= t the image you just saved, and choose "proceed" in this window. +=20 + If you want to investigate further, choose "debug" in this window. Do not= use the debugger "fullStack" command unless you are certain that the stack i= s not very deep. (Trying to show the full stack will definitely use up all re= maining memory if the low-space problem is caused by an infinite recursion!!). +=20 + ' + ! Item was added: + ----- Method: LowSpaceWatcher>>lowSpaceWatcher (in category 'process') ----- + lowSpaceWatcher + "Wait until the low space semaphore is signalled, then take appropriate ac= tions. This + method is run once in the low space watcher process. Before terminating, i= t schedules + a new process to handle the next low space condition." +=20 + self safeToInstall ifFalse: [ ^ Beeper beep]. + self initializeVirtualMachineNotifications. + lowSpaceSemaphore wait. + self disableVirtualMachineNotifications; handleLowSpaceCondition. + self start. "schedule a new process to handle the next low space condition" +=20 + ! Item was added: + ----- Method: LowSpaceWatcher>>lowSpaceWatcherProcess (in category 'process= ') ----- + lowSpaceWatcherProcess + "Answer the process in which lowSpaceWatcher is running. A process browser + can use this to identify and label the system wide low space watcher proce= ss." + ^lowSpaceProcess! Item was added: + ----- Method: LowSpaceWatcher>>memoryHogs (in category 'memory space') ----- + memoryHogs + "Answer the list of objects to notify with #freeSomeSpace if memory gets f= ull." +=20 + ^ MemoryHogs ifNil: [MemoryHogs :=3D OrderedCollection new]! Item was added: + ----- Method: LowSpaceWatcher>>notifyMemoryHogs (in category 'process steps= ') ----- + notifyMemoryHogs + "Try to clean up memory hogs. Answer true if sufficient memory was release= d." +=20 + | free | + self memoryHogs isEmpty + ifTrue: [ ^ false ] + ifFalse: [ free :=3D Smalltalk bytesLeft. + self memoryHogs + do: [ :hog | hog freeSomeSpace ]. + ^ Smalltalk bytesLeft > free ] +=20 + ! Item was added: + ----- Method: LowSpaceWatcher>>notifyUser: (in category 'process steps') --= --- + notifyUser: preemptedProcess + "Interrupt the user to allow the low space condition to be corrected. The = user + is now unprotected until the low space watcher is re-installed." +=20 + Project current + interruptName: 'Space is low' + message: self lowSpaceChoices + preemptedProcess: preemptedProcess. + ! Item was added: + ----- Method: LowSpaceWatcher>>primLowSpaceSemaphore: (in category 'primiti= ve access') ----- + primLowSpaceSemaphore: aSemaphore + "Primitive. Register the given Semaphore to be signalled when the + number of free bytes drops below some threshold. Disable low-space + interrupts if the argument is nil." +=20 + + self primitiveFailed! Item was added: + ----- Method: LowSpaceWatcher>>primSignalAtBytesLeft: (in category 'primiti= ve access') ----- + primSignalAtBytesLeft: numBytes + "Tell the interpreter the low-space threshold in bytes. When the free + space falls below this threshold, the interpreter will signal the low-space + semaphore, if one has been registered. Disable low-space interrupts if the + argument is zero. Fail if numBytes is not an Integer." +=20 + + self primitiveFailed! Item was added: + ----- Method: LowSpaceWatcher>>safeToInstall (in category 'process steps') = ----- + safeToInstall + "Free space must be above threshold before starting low space watcher" +=20 + ^Smalltalk garbageCollectMost > Smalltalk lowSpaceThreshold + or: [Smalltalk garbageCollect > Smalltalk lowSpaceThreshold] +=20 + ! Item was added: + ----- Method: LowSpaceWatcher>>signalLowSpace (in category 'memory space') = ----- + signalLowSpace + "Signal the low-space semaphore to alert the user that space is running lo= w." +=20 + lowSpaceSemaphore signal.! Item was added: + ----- Method: LowSpaceWatcher>>start (in category 'initialize-release') ---= -- + start + "Start a new low space watcher process that will register a semaphore with= the + virtual machine and wait for the semaphore to be signalled if a low space = condition + is detected." +=20 + lowSpaceProcess :=3D [self lowSpaceWatcher] forkAt: Processor lowIOPriorit= y. + ! Item was added: + ----- Method: LowSpaceWatcher>>stop (in category 'initialize-release') ----- + stop. + "Ask the virtual machine to disable low space interrupts, then terminate t= he watcher process." +=20 + self primSignalAtBytesLeft: 0. "disable low-space interrupts" + lowSpaceProcess =3D=3D nil ifFalse: [lowSpaceProcess terminate]. + lowSpaceProcess :=3D lowSpaceSemaphore :=3D nil. + ! Item was changed: Object subclass: #SmalltalkImage instanceVariableNames: 'globals' + classVariableNames: 'EndianCache LastImageName LastQuitLogPosition LastSta= ts PlatformNameCache ShutDownList SourceFileVersionString StartUpList Startup= Stamp VMMakerVersion WordSize' - classVariableNames: 'EndianCache LastImageName LastQuitLogPosition LastSta= ts LowSpaceProcess LowSpaceSemaphore MemoryHogs PlatformNameCache ShutDownLis= t SourceFileVersionString StartUpList StartupStamp VMMakerVersion WordSize' poolDictionaries: '' category: 'System-Support'! =20 !SmalltalkImage commentStamp: 'dtl 3/6/2010 14:00' prior: 0! I represent the current image and runtime environment, including system org= anization, the virtual machine, object memory, plugins and source files. My i= nstance variable #globals is a reference to the system dictionary of global v= ariables and class names. =20 My singleton instance is called Smalltalk.! Item was changed: ----- Method: SmalltalkImage>>installLowSpaceWatcher (in category 'memory s= pace') ----- installLowSpaceWatcher "Start a process to watch for low-space conditions." "Smalltalk installLowSpaceWatcher" =20 + LowSpaceWatcher install - self primSignalAtBytesLeft: 0. "disable low-space interrupts" - LowSpaceProcess =3D=3D nil ifFalse: [LowSpaceProcess terminate]. - LowSpaceProcess :=3D [self lowSpaceWatcher] newProcess. - LowSpaceProcess priority: Processor lowIOPriority. - LowSpaceProcess resume. =20 ! Item was removed: - ----- Method: SmalltalkImage>>lowSpaceChoices (in category 'memory space') = ----- - lowSpaceChoices - "Return a notifier message string to be presented when space is running lo= w." -=20 - ^ 'Warning!! Squeak is almost out of memory!! -=20 - Low space detection is now disabled. It will be restored when you close or = proceed from this error notifier. Don''t panic, but do proceed with caution. -=20 - Here are some suggestions: -=20 - If you suspect an infinite recursion (the same methods calling each other = again and again), then close this debugger, and fix the problem. -=20 - If you want this computation to finish, then make more space available (re= ad on) and choose "proceed" in this debugger. Here are some ways to make more= space available... - > Close any windows that are not needed. - > Get rid of some large objects (e.g., images). - > Leave this window on the screen, choose "save as..." from the screen m= enu, quit, restart the Squeak VM with a larger memory allocation, then restar= t the image you just saved, and choose "proceed" in this window. -=20 - If you want to investigate further, choose "debug" in this window. Do not= use the debugger "fullStack" command unless you are certain that the stack i= s not very deep. (Trying to show the full stack will definitely use up all re= maining memory if the low-space problem is caused by an infinite recursion!!). -=20 - ' - ! Item was removed: - ----- Method: SmalltalkImage>>lowSpaceWatcher (in category 'memory space') = ----- - lowSpaceWatcher - "Wait until the low space semaphore is signalled, then take appropriate ac= tions." -=20 - | free preemptedProcess | - self garbageCollectMost <=3D self lowSpaceThreshold - ifTrue: [self garbageCollect <=3D self lowSpaceThreshold - ifTrue: ["free space must be above threshold before - starting low space watcher" - ^ Beeper beep]]. -=20 - Smalltalk specialObjectsArray at: 23 put: nil. "process causing low space= will be saved here" - LowSpaceSemaphore :=3D Semaphore new. - self primLowSpaceSemaphore: LowSpaceSemaphore. - self primSignalAtBytesLeft: self lowSpaceThreshold. "enable low space int= errupts" -=20 - LowSpaceSemaphore wait. "wait for a low space condition..." -=20 - self primSignalAtBytesLeft: 0. "disable low space interrupts" - self primLowSpaceSemaphore: nil. - LowSpaceProcess :=3D nil. -=20 - "The process that was active at the time of the low space interrupt." - preemptedProcess :=3D (Smalltalk specialObjectsArray at: 23) - ifNil: [Processor preemptedProcess "if in-image signal of OutOfMemory"]. - Smalltalk specialObjectsArray at: 23 put: nil. -=20 - "Note: user now unprotected until the low space watcher is re-installed" -=20 - self memoryHogs isEmpty - ifFalse: [free :=3D self bytesLeft. - self memoryHogs - do: [ :hog | hog freeSomeSpace ]. - self bytesLeft > free - ifTrue: [ ^ self installLowSpaceWatcher ]]. -=20 - Preferences logDebuggerStackToFile ifTrue: [ - self - logError: 'Space is low' - inContext: preemptedProcess suspendedContext - to: 'LowSpaceDebug.log']. - =09 - Project current - interruptName: 'Space is low' - message: self lowSpaceChoices - preemptedProcess: preemptedProcess - ! Item was changed: ----- Method: SmalltalkImage>>lowSpaceWatcherProcess (in category 'memory s= pace') ----- lowSpaceWatcherProcess + ^LowSpaceWatcher default ifNotNil: [ :watcher | watcher lowSpaceWatcherPr= ocess ]! - ^LowSpaceProcess! Item was removed: - ----- Method: SmalltalkImage>>memoryHogs (in category 'memory space') ----- - memoryHogs - "Answer the list of objects to notify with #freeSomeSpace if memory gets f= ull." -=20 - ^ MemoryHogs ifNil: [MemoryHogs :=3D OrderedCollection new]! Item was removed: - ----- Method: SmalltalkImage>>primLowSpaceSemaphore: (in category 'memory s= pace') ----- - primLowSpaceSemaphore: aSemaphore - "Primitive. Register the given Semaphore to be signalled when the - number of free bytes drops below some threshold. Disable low-space - interrupts if the argument is nil." -=20 - - self primitiveFailed! Item was removed: - ----- Method: SmalltalkImage>>primSignalAtBytesLeft: (in category 'memory s= pace') ----- - primSignalAtBytesLeft: numBytes - "Tell the interpreter the low-space threshold in bytes. When the free - space falls below this threshold, the interpreter will signal the low-space - semaphore, if one has been registered. Disable low-space interrupts if the - argument is zero. Fail if numBytes is not an Integer." -=20 - - self primitiveFailed! Item was removed: - ----- Method: SmalltalkImage>>signalLowSpace (in category 'memory space') -= ---- - signalLowSpace - "Signal the low-space semaphore to alert the user that space is running lo= w." -=20 - LowSpaceSemaphore signal.! --===============3344218382063454111==-- From commits@source.squeak.org Thu Feb 22 00:17:02 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Treated Inbox: System-dtl.1447.mcz Date: Thu, 22 Feb 2024 00:16:56 +0000 Message-ID: <20240222001659.94390582665@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6471042427258559737==" --===============6471042427258559737== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable David T. Lewis uploaded a new version of System to project The Treated Inbox: http://source.squeak.org/treated/System-dtl.1447.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: System-dtl.1447 Author: dtl Time: 18 February 2024, 10:30:07.309835 am UUID: 532176ff-7a46-4306-a373-252ca1cc09f2 Ancestors: System-codefrau.1446 Move the low space watcher from SmalltalkImage to new class LowSpaceWatcher h= aving a singleton with responsibility for the low space semaphore and low spa= ce watcher process. Add class and method comments and split lowSpaceWatcher i= nto smaller methods to clarify steps in the process. Add #registerCleaner for= adding savvy memory hogs to the memory hog registry. For organization and do= cumentation only, no functional change to the low space watcher or memory pol= icies. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against System-codefrau.14= 46 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + Object subclass: #LowSpaceWatcher + instanceVariableNames: 'lowSpaceProcess lowSpaceSemaphore' + classVariableNames: 'Default MemoryHogs' + poolDictionaries: '' + category: 'System-Support'! +=20 + !LowSpaceWatcher commentStamp: 'dtl 1/28/2024 17:56' prior: 0! + LowSpaceWatcher is responsible for responding to a notification from the vi= rtual machine that memory is low and that it (the VM) may soon be unable to s= upport additional object memory allocations. A single default instance for th= e image manages both the low space semaphore and the process that waits on th= e semaphore to handle low space conditions. When the low space watcher is not= ified that memory is low, it attempts to identify the process likely associat= ed with the low space condition and to provide a notifier to allow the proble= m condition to be corrected. +=20 + If a low space condition is detected in the virtual machine, the low space = semaphore is signalled either directly by the VM or indirectly through an Out= OfMemory error following a failed primitive invocation. The VM is responsible= for identifying low space conditions, and its behavior will vary depending o= n both the VM implementation and the memory system of the underlying platform= operating system. In particular, on a virtual machine operating system the V= M may continue to receive memory allocations from the operating system while = the operating system attempts to support the memory requests by increased swa= pping to disk. Under these conditions, the low space semaphore may not be sig= nalled because system memory still appears to be available, even though perfo= rmance is severely degraded due to swapping. +=20 + The VM may provide control of its memory usage, typically through command l= ine parameters or VM parameters that can be set from the image. These paramet= ers will affect when and if the low space watcher is signalled by the VM. +=20 + A registry is maintained in class variable MemoryHogs to identify objects (= classes) know how to release unneeded memory when sent the message #freeSomeS= pace. The low space watcher process will send this message when a low spaced = condition is encountered. +=20 + To signal the low space watcher and simulate a low space condition, evaluat= e "LowSpaceWatcher default signalLowSpace".! Item was added: + ----- Method: LowSpaceWatcher class>>default (in category 'instance creatio= n') ----- + default + "The singleton low space watcher." +=20 + ^ Default ifNil: [ Default :=3D self new start ] + ! Item was added: + ----- Method: LowSpaceWatcher class>>install (in category 'instance creatio= n') ----- + install + "Start a process to watch for low-space conditions." + "Smalltalk installLowSpaceWatcher" +=20 + self default stop; start +=20 + ! Item was added: + ----- Method: LowSpaceWatcher class>>registerCleaner: (in category 'memory = hog registry') ----- + registerCleaner: memoryCleaner + "Add memoryCleaner to the MemoryHog list where memoryCleaner is an object = or class that responds to #freeSomeSpace." +=20 + (memoryCleaner respondsTo: #freeSomeSpace) + ifFalse: [ ^ self error: memoryCleaner asString, ' does not understand #f= reeSomeSpace' ]. + (self default memoryHogs includes: memoryCleaner) + ifFalse: [ MemoryHogs add: memoryCleaner ].! Item was added: + ----- Method: LowSpaceWatcher class>>signalLowSpace (in category 'signal lo= w space') ----- + signalLowSpace + "Signal the low-space semaphore to alert the user that space is running lo= w." +=20 + ^ self default signalLowSpace.! Item was added: + ----- Method: LowSpaceWatcher>>disableVirtualMachineNotifications (in categ= ory 'process steps') ----- + disableVirtualMachineNotifications + "Ask the virtual machine to stop sending low space interrupts, and forget = the current semaphore and watcher process." +=20 + self primSignalAtBytesLeft: 0. "disable low space interrupts" + self primLowSpaceSemaphore: nil. + lowSpaceProcess :=3D nil. + ! Item was added: + ----- Method: LowSpaceWatcher>>findPreemptedProcess (in category 'process s= teps') ----- + findPreemptedProcess + "Find the process that was active at the time of the low space interrupt. = Check + first if the virtual machine has recorded the process that was active at t= he time + that it detected the low space detection, otherwise answer the process tha= t was + most recently preempted when the semaphore was signalled." +=20 + | preemptedProcess | + preemptedProcess :=3D (Smalltalk specialObjectsArray at: 23) + ifNil: [Processor preemptedProcess "if in-image signal of OutOfMemory"]. + Smalltalk specialObjectsArray at: 23 put: nil. + ^ preemptedProcess +=20 + ! Item was added: + ----- Method: LowSpaceWatcher>>handleLowSpaceCondition (in category 'proces= s') ----- + handleLowSpaceCondition + "A low space condition has been detected. Do whatever may be necessary to = free + some memory in the image before proceeding." +=20 + | preemptedProcess | + preemptedProcess :=3D self findPreemptedProcess. + self notifyMemoryHogs ifFalse: [ + self logError: preemptedProcess. + self notifyUser: preemptedProcess ]. +=20 + ! Item was added: + ----- Method: LowSpaceWatcher>>initializeVirtualMachineNotifications (in ca= tegory 'process steps') ----- + initializeVirtualMachineNotifications + "Let the virtual machine know how to notify the image of low space conditi= ons." +=20 + Smalltalk specialObjectsArray at: 23 put: nil. "process causing low space= will be saved here" + lowSpaceSemaphore :=3D Semaphore new. + self primLowSpaceSemaphore: lowSpaceSemaphore. + self primSignalAtBytesLeft: Smalltalk lowSpaceThreshold. "enable low spac= e interrupts" + ! Item was added: + ----- Method: LowSpaceWatcher>>logError: (in category 'process steps') ----- + logError: preemptedProcess +=20 + Preferences logDebuggerStackToFile ifTrue: [ + Smalltalk + logError: 'Space is low' + inContext: preemptedProcess suspendedContext + to: 'LowSpaceDebug.log' ]. + ! Item was added: + ----- Method: LowSpaceWatcher>>lowSpaceChoices (in category 'memory space')= ----- + lowSpaceChoices + "Return a notifier message string to be presented when space is running lo= w." +=20 + ^ 'Warning!! Squeak is almost out of memory!! +=20 + Low space detection is now disabled. It will be restored when you close or = proceed from this error notifier. Don''t panic, but do proceed with caution. +=20 + Here are some suggestions: +=20 + If you suspect an infinite recursion (the same methods calling each other = again and again), then close this debugger, and fix the problem. +=20 + If you want this computation to finish, then make more space available (re= ad on) and choose "proceed" in this debugger. Here are some ways to make more= space available... + > Close any windows that are not needed. + > Get rid of some large objects (e.g., images). + > Leave this window on the screen, choose "save as..." from the screen m= enu, quit, restart the Squeak VM with a larger memory allocation, then restar= t the image you just saved, and choose "proceed" in this window. +=20 + If you want to investigate further, choose "debug" in this window. Do not= use the debugger "fullStack" command unless you are certain that the stack i= s not very deep. (Trying to show the full stack will definitely use up all re= maining memory if the low-space problem is caused by an infinite recursion!!). +=20 + ' + ! Item was added: + ----- Method: LowSpaceWatcher>>lowSpaceWatcher (in category 'process') ----- + lowSpaceWatcher + "Wait until the low space semaphore is signalled, then take appropriate ac= tions. This + method is run once in the low space watcher process. Before terminating, i= t schedules + a new process to handle the next low space condition." +=20 + self safeToInstall ifFalse: [ ^ Beeper beep]. + self initializeVirtualMachineNotifications. + lowSpaceSemaphore wait. + self disableVirtualMachineNotifications; handleLowSpaceCondition. + self start. "schedule a new process to handle the next low space condition" +=20 + ! Item was added: + ----- Method: LowSpaceWatcher>>lowSpaceWatcherProcess (in category 'process= ') ----- + lowSpaceWatcherProcess + "Answer the process in which lowSpaceWatcher is running. A process browser + can use this to identify and label the system wide low space watcher proce= ss." + ^lowSpaceProcess! Item was added: + ----- Method: LowSpaceWatcher>>memoryHogs (in category 'memory space') ----- + memoryHogs + "Answer the list of objects to notify with #freeSomeSpace if memory gets f= ull." +=20 + ^ MemoryHogs ifNil: [MemoryHogs :=3D OrderedCollection new]! Item was added: + ----- Method: LowSpaceWatcher>>notifyMemoryHogs (in category 'process steps= ') ----- + notifyMemoryHogs + "Try to clean up memory hogs. Answer true if sufficient memory was release= d." +=20 + | free | + self memoryHogs isEmpty + ifTrue: [ ^ false ] + ifFalse: [ free :=3D Smalltalk bytesLeft. + self memoryHogs + do: [ :hog | hog freeSomeSpace ]. + ^ Smalltalk bytesLeft > free ] +=20 + ! Item was added: + ----- Method: LowSpaceWatcher>>notifyUser: (in category 'process steps') --= --- + notifyUser: preemptedProcess + "Interrupt the user to allow the low space condition to be corrected. The = user + is now unprotected until the low space watcher is re-installed." +=20 + Project current + interruptName: 'Space is low' + message: self lowSpaceChoices + preemptedProcess: preemptedProcess. + ! Item was added: + ----- Method: LowSpaceWatcher>>primLowSpaceSemaphore: (in category 'primiti= ve access') ----- + primLowSpaceSemaphore: aSemaphore + "Primitive. Register the given Semaphore to be signalled when the + number of free bytes drops below some threshold. Disable low-space + interrupts if the argument is nil." +=20 + + self primitiveFailed! Item was added: + ----- Method: LowSpaceWatcher>>primSignalAtBytesLeft: (in category 'primiti= ve access') ----- + primSignalAtBytesLeft: numBytes + "Tell the interpreter the low-space threshold in bytes. When the free + space falls below this threshold, the interpreter will signal the low-space + semaphore, if one has been registered. Disable low-space interrupts if the + argument is zero. Fail if numBytes is not an Integer." +=20 + + self primitiveFailed! Item was added: + ----- Method: LowSpaceWatcher>>safeToInstall (in category 'process steps') = ----- + safeToInstall + "Free space must be above threshold before starting low space watcher" +=20 + ^Smalltalk garbageCollectMost > Smalltalk lowSpaceThreshold + or: [Smalltalk garbageCollect > Smalltalk lowSpaceThreshold] +=20 + ! Item was added: + ----- Method: LowSpaceWatcher>>signalLowSpace (in category 'memory space') = ----- + signalLowSpace + "Signal the low-space semaphore to alert the user that space is running lo= w." +=20 + lowSpaceSemaphore signal.! Item was added: + ----- Method: LowSpaceWatcher>>start (in category 'initialize-release') ---= -- + start + "Start a new low space watcher process that will register a semaphore with= the + virtual machine and wait for the semaphore to be signalled if a low space = condition + is detected." +=20 + lowSpaceProcess :=3D [self lowSpaceWatcher] forkAt: Processor lowIOPriorit= y. + ! Item was added: + ----- Method: LowSpaceWatcher>>stop (in category 'initialize-release') ----- + stop. + "Ask the virtual machine to disable low space interrupts, then terminate t= he watcher process." +=20 + self primSignalAtBytesLeft: 0. "disable low-space interrupts" + lowSpaceProcess =3D=3D nil ifFalse: [lowSpaceProcess terminate]. + lowSpaceProcess :=3D lowSpaceSemaphore :=3D nil. + ! Item was changed: Object subclass: #SmalltalkImage instanceVariableNames: 'globals' + classVariableNames: 'EndianCache LastImageName LastQuitLogPosition LastSta= ts PlatformNameCache ShutDownList SourceFileVersionString StartUpList Startup= Stamp VMMakerVersion WordSize' - classVariableNames: 'EndianCache LastImageName LastQuitLogPosition LastSta= ts LowSpaceProcess LowSpaceSemaphore MemoryHogs PlatformNameCache ShutDownLis= t SourceFileVersionString StartUpList StartupStamp VMMakerVersion WordSize' poolDictionaries: '' category: 'System-Support'! =20 !SmalltalkImage commentStamp: 'dtl 3/6/2010 14:00' prior: 0! I represent the current image and runtime environment, including system org= anization, the virtual machine, object memory, plugins and source files. My i= nstance variable #globals is a reference to the system dictionary of global v= ariables and class names. =20 My singleton instance is called Smalltalk.! Item was changed: ----- Method: SmalltalkImage>>installLowSpaceWatcher (in category 'memory s= pace') ----- installLowSpaceWatcher "Start a process to watch for low-space conditions." "Smalltalk installLowSpaceWatcher" =20 + LowSpaceWatcher install - self primSignalAtBytesLeft: 0. "disable low-space interrupts" - LowSpaceProcess =3D=3D nil ifFalse: [LowSpaceProcess terminate]. - LowSpaceProcess :=3D [self lowSpaceWatcher] newProcess. - LowSpaceProcess priority: Processor lowIOPriority. - LowSpaceProcess resume. =20 ! Item was removed: - ----- Method: SmalltalkImage>>lowSpaceChoices (in category 'memory space') = ----- - lowSpaceChoices - "Return a notifier message string to be presented when space is running lo= w." -=20 - ^ 'Warning!! Squeak is almost out of memory!! -=20 - Low space detection is now disabled. It will be restored when you close or = proceed from this error notifier. Don''t panic, but do proceed with caution. -=20 - Here are some suggestions: -=20 - If you suspect an infinite recursion (the same methods calling each other = again and again), then close this debugger, and fix the problem. -=20 - If you want this computation to finish, then make more space available (re= ad on) and choose "proceed" in this debugger. Here are some ways to make more= space available... - > Close any windows that are not needed. - > Get rid of some large objects (e.g., images). - > Leave this window on the screen, choose "save as..." from the screen m= enu, quit, restart the Squeak VM with a larger memory allocation, then restar= t the image you just saved, and choose "proceed" in this window. -=20 - If you want to investigate further, choose "debug" in this window. Do not= use the debugger "fullStack" command unless you are certain that the stack i= s not very deep. (Trying to show the full stack will definitely use up all re= maining memory if the low-space problem is caused by an infinite recursion!!). -=20 - ' - ! Item was removed: - ----- Method: SmalltalkImage>>lowSpaceWatcher (in category 'memory space') = ----- - lowSpaceWatcher - "Wait until the low space semaphore is signalled, then take appropriate ac= tions." -=20 - | free preemptedProcess | - self garbageCollectMost <=3D self lowSpaceThreshold - ifTrue: [self garbageCollect <=3D self lowSpaceThreshold - ifTrue: ["free space must be above threshold before - starting low space watcher" - ^ Beeper beep]]. -=20 - Smalltalk specialObjectsArray at: 23 put: nil. "process causing low space= will be saved here" - LowSpaceSemaphore :=3D Semaphore new. - self primLowSpaceSemaphore: LowSpaceSemaphore. - self primSignalAtBytesLeft: self lowSpaceThreshold. "enable low space int= errupts" -=20 - LowSpaceSemaphore wait. "wait for a low space condition..." -=20 - self primSignalAtBytesLeft: 0. "disable low space interrupts" - self primLowSpaceSemaphore: nil. - LowSpaceProcess :=3D nil. -=20 - "The process that was active at the time of the low space interrupt." - preemptedProcess :=3D (Smalltalk specialObjectsArray at: 23) - ifNil: [Processor preemptedProcess "if in-image signal of OutOfMemory"]. - Smalltalk specialObjectsArray at: 23 put: nil. -=20 - "Note: user now unprotected until the low space watcher is re-installed" -=20 - self memoryHogs isEmpty - ifFalse: [free :=3D self bytesLeft. - self memoryHogs - do: [ :hog | hog freeSomeSpace ]. - self bytesLeft > free - ifTrue: [ ^ self installLowSpaceWatcher ]]. -=20 - Preferences logDebuggerStackToFile ifTrue: [ - self - logError: 'Space is low' - inContext: preemptedProcess suspendedContext - to: 'LowSpaceDebug.log']. - =09 - Project current - interruptName: 'Space is low' - message: self lowSpaceChoices - preemptedProcess: preemptedProcess - ! Item was changed: ----- Method: SmalltalkImage>>lowSpaceWatcherProcess (in category 'memory s= pace') ----- lowSpaceWatcherProcess + ^LowSpaceWatcher default ifNotNil: [ :watcher | watcher lowSpaceWatcherPr= ocess ]! - ^LowSpaceProcess! Item was removed: - ----- Method: SmalltalkImage>>memoryHogs (in category 'memory space') ----- - memoryHogs - "Answer the list of objects to notify with #freeSomeSpace if memory gets f= ull." -=20 - ^ MemoryHogs ifNil: [MemoryHogs :=3D OrderedCollection new]! Item was removed: - ----- Method: SmalltalkImage>>primLowSpaceSemaphore: (in category 'memory s= pace') ----- - primLowSpaceSemaphore: aSemaphore - "Primitive. Register the given Semaphore to be signalled when the - number of free bytes drops below some threshold. Disable low-space - interrupts if the argument is nil." -=20 - - self primitiveFailed! Item was removed: - ----- Method: SmalltalkImage>>primSignalAtBytesLeft: (in category 'memory s= pace') ----- - primSignalAtBytesLeft: numBytes - "Tell the interpreter the low-space threshold in bytes. When the free - space falls below this threshold, the interpreter will signal the low-space - semaphore, if one has been registered. Disable low-space interrupts if the - argument is zero. Fail if numBytes is not an Integer." -=20 - - self primitiveFailed! Item was removed: - ----- Method: SmalltalkImage>>signalLowSpace (in category 'memory space') -= ---- - signalLowSpace - "Signal the low-space semaphore to alert the user that space is running lo= w." -=20 - LowSpaceSemaphore signal.! --===============6471042427258559737==-- From commits@source.squeak.org Sat Feb 24 07:21:49 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: JSON-cmm.62.mcz Date: Sat, 24 Feb 2024 07:21:45 +0000 Message-ID: <20240224072148.BA61A58266C@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5644846323411924178==" --===============5644846323411924178== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Chris Muller uploaded a new version of JSON to project The Trunk: http://source.squeak.org/trunk/JSON-cmm.62.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: JSON-cmm.62 Author: cmm Time: 24 February 2024, 1:21:44.121899 am UUID: 8a043f53-c158-4a2a-b29a-0fb20d53d6a9 Ancestors: JSON-cmm.61 - Prefix json extension methods to indicate they're intended for Json outputs. - Better comments, implementations and tests for new path accessing functions. - Fix and a test an Array of Associations to be a Json object. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against JSON-cmm.61 =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was removed: - ----- Method: Collection>>atPath: (in category '*json') ----- - atPath: anArray=20 - "Assume I'm a set of nested HashedCollections and/or SequenceableCollectio= ns. Answer the object at the path of indices and/or keys identified in anArr= ay." - ^ self - atPath: anArray - ifLost: [ : last | self error: 'path lost after' , last asString ]! Item was removed: - ----- Method: Collection>>atPath:ifLost: (in category '*json') ----- - atPath: anArray ifLost: aBlock - "Assume I'm a set of nested HashedCollections and/or SequenceableCollectio= ns. Answer the object at the path of indices and/or keys identified in anArr= ay. If the full path specified by anArray isn't present, cull aBlock with th= e last element present along the path." - | last | - ^ (self - path: anArray - do: [ : elem : node | last :=3D node ]) - ifNil: [ aBlock cull: last ] - ifNotNil: [ last ]! Item was added: + ----- Method: Collection>>jsonAtPath: (in category '*json') ----- + jsonAtPath: anArray=20 + "Assume I'm Json output. Answer the object at the path of indices and/or = keys identified in anArray. If the full path specified by anArray isn't foun= d, signal an Error." + ^ self + jsonAtPath: anArray + ifLost: [ : last | self error: 'path lost after index ' , last asString ]! Item was added: + ----- Method: Collection>>jsonAtPath:ifLost: (in category '*json') ----- + jsonAtPath: anArray ifLost: aBlock=20 + "Assume I'm a Json object. Answer the sub-object at the path of indices a= nd/or keys identified in anArray. If the full path specified by anArray isn'= t present, stop, and answer the value of aBlock culled with the index of the = element within anArray that isn't found." + | last index | + index :=3D 0. + ^ (self + jsonPath: anArray + do: + [ : elem : node | index :=3D index + 1. + last :=3D node ]) + ifNil: [ aBlock cull: index+1] + ifNotNil: [ last ]! Item was added: + ----- Method: Collection>>jsonPath:do: (in category '*json') ----- + jsonPath: anArray do: aBlock=20 + "Assume I'm a Json output. Value aBlock with each object along the path o= f keys and/or indices identified in anArray. If a path element isn't found, = stop, and return nil, otherwise, return self." + | current | + current :=3D self. + anArray do: + [ : eachKey | "Json doesn't have Characters, allow pathing into Json obje= cts only." + (current isArray or: [ current isDictionary ]) + ifTrue: + [ current + at: eachKey + ifPresent: + [ : eachValue | aBlock + value: eachKey + value: eachValue. + current :=3D eachValue ] + ifAbsent: [ ^ nil ] ] + ifFalse: [ ^ nil ] ]. + ^ self! Item was added: + ----- Method: Collection>>jsonWriteListOn: (in category '*json') ----- + jsonWriteListOn: aStream + "By default, use array braces " + aStream nextPut: $[. + =09 + self do: [:each | + each jsonWriteOn: aStream + ] separatedBy: [ aStream nextPut: $, ]. +=20 + aStream nextPut: $]! Item was added: + ----- Method: Collection>>jsonWriteObjectOn: (in category '*json') ----- + jsonWriteObjectOn: aStream +=20 + | needComma | + needComma :=3D false. + aStream nextPut: ${. + self associationsDo: [ :assoc | + needComma + ifTrue: [ aStream nextPut: $, ] + ifFalse: [ needComma :=3D true ]. + assoc key jsonWriteOn: aStream. + aStream nextPut: $:. + assoc value jsonWriteOn: aStream ]. + aStream nextPut: $}.! Item was changed: ----- Method: Collection>>jsonWriteOn: (in category '*json') ----- jsonWriteOn: aStream + (self notEmpty and: [self anyOne isVariableBinding]) + ifTrue: [ self jsonWriteObjectOn: aStream ] + ifFalse: [ self jsonWriteListOn: aStream ]! - "By default, use array braces " - aStream nextPut: $[. - =09 - self do: [:each | - each jsonWriteOn: aStream - ] separatedBy: [ aStream nextPut: $, ]. -=20 - aStream nextPut: $]! Item was removed: - ----- Method: Collection>>path:do: (in category '*json') ----- - path: anArray do: aBlock=20 - "Assume I'm a set of nested HashedCollections and/or SequenceableCollectio= ns. Value aBlock with each object along the path of indices and/or keys iden= tified in anArray. If a path element isn't found, stop, and return nil, othe= rwise, return self." - anArray - inject: self - into: - [ : dictOrArray : pathElem | dictOrArray - at: pathElem - ifPresent: [ : node | aBlock value: pathElem value: node ] - ifAbsent: [ ^ nil ] ]. - ^ self! Item was added: + ----- Method: JsonTests>>testNonDictionaryJsonObject (in category 'tests') = ----- + testNonDictionaryJsonObject + self + render: {'a' -> 1. 'b' -> 2} + equals: '{"a":1,"b":2}'! Item was added: + ----- Method: JsonTests>>testPathAccess (in category 'tests') ----- + testPathAccess + | json lost | json :=3D Json readFrom: '{=20 + "smalltalk" : { + "platformName":"unix", + "classes" : [ + { "id" : 3557, "name":"Integer" }, + { "id" : 3558, "name":"Float" }, + { "id" : 3559, "name":"Fraction" } + ] + }=20 + }' readStream. + self assert: (json jsonAtPath: #('smalltalk' 'platformName')) =3D 'unix'. + "With array in the path." + self assert: (json jsonAtPath: #('smalltalk' 'classes' 1 'id')) =3D 3557. + self assert: (json jsonAtPath: #('smalltalk' 'classes' 2 'name')) =3D 'Flo= at'. + "No pathing into byte objects, only Json objects." + self + should: [json jsonAtPath: #('smalltalk' 'classes' 2 'name' "Not allowed = --->" 1)] + raise: Error. + "Key not found." + self=20 + should: [ json jsonAtPath: #('smalltalk' 'wordSize') ] + raise: Error. + lost :=3D false. + json + jsonAtPath: #('smalltalk' 'wordSize') + ifLost: [ : lostPosition | lost :=3D true. self assert: lostPosition =3D= 2 ]. + self assert: lost. + "Index OOB" + self=20 + should: [ json jsonAtPath: #('smalltalk' 'classes' 99) ] + raise: Error. + lost :=3D false. + json + jsonAtPath: #('smalltalk' 'classes' 99) + ifLost: [ : lostPosition | lost :=3D true. self assert: lostPosition =3D = 3 ]. + self assert: lost! --===============5644846323411924178==-- From commits@source.squeak.org Sat Feb 24 19:42:26 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1553.mcz Date: Sat, 24 Feb 2024 19:42:17 +0000 Message-ID: <20240224194224.6E52B5826A3@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1008454738728940108==" --===============1008454738728940108== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1553.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1553 Author: ct Time: 24 February 2024, 8:42:15.180459 pm UUID: bfcd6789-4af9-cc41-8278-5a27709723d5 Ancestors: Kernel-mt.1551, Kernel-ct.1293 Merges and revises Kernel-ct.1293: Elaborate method comment in Object >> #copyFrom: See: https://lists.squeakfoundation.org/archives/list/squeak-dev(a)lists.sque= akfoundation.org/thread/ZUJ26UOEM3TNKRCBUBGRZJ6ZO5PQTGOT/ =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-mt.1551 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: CompiledCode>>copyFrom: (in category 'copying') ----- copyFrom: anotherObject + "Copy to myself all slots I have in common with anotherObject, i.e., all v= ariables names which have the same index in both classes and all element indi= ces which are available in both classes. + This is dangerous because it ignores an object's control over its own inst= vars." - "Copy to myself all instance variables I have in common with anotherObject. - This is dangerous because it ignores an object's control over its own ins= t vars." =20 anotherObject isCompiledCode ifTrue: [1 to: self numLiterals do: [:i| self literalAt: i put: (anotherObject literalAt: i)]] ifFalse: [1 to: self numLiterals do: [:i| self literalAt: i put: (anotherObject at: i)]]. self initialPC to: (self basicSize min: anotherObject basicSize) do: [:i| self basicAt: i put: (anotherObject basicAt: i)]! Item was changed: ----- Method: Object>>copyFrom: (in category 'copying') ----- copyFrom: anotherObject + "Copy to myself all slots I have in common with anotherObject, i.e., all v= ariables names which have the same index in both classes and all element indi= ces which are available in both classes. + This is dangerous because it ignores an object's control over its own inst= vars." - "Copy to myself all instance variables I have in common with anotherObject= . This is dangerous because it ignores an object's control over its own inst= vars. " =20 | mine his | mine :=3D self class allInstVarNames. his :=3D anotherObject class allInstVarNames. 1 to: (mine size min: his size) do: [:ind | (mine at: ind) =3D (his at: ind) ifTrue: [ self instVarAt: ind put: (anotherObject instVarAt: ind)]]. self class isVariable & anotherObject class isVariable ifTrue: [ 1 to: (self basicSize min: anotherObject basicSize) do: [:ind | self basicAt: ind put: (anotherObject basicAt: ind)]].! Item was changed: ----- Method: Object>>copySameFrom: (in category 'copying') ----- copySameFrom: otherObject "Copy to myself all instance variables named the same in otherObject. + This is dangerous because it ignores an object's control over its own inst= vars." - This ignores otherObject's control over its own inst vars." =20 | myInstVars otherInstVars | myInstVars :=3D self class allInstVarNames. otherInstVars :=3D otherObject class allInstVarNames. myInstVars withIndexDo: [:each :index | | match | (match :=3D otherInstVars indexOf: each) > 0 ifTrue: [self instVarAt: index put: (otherObject instVarAt: match)]]. 1 to: (self basicSize min: otherObject basicSize) do: [:i | self basicAt: i put: (otherObject basicAt: i)]. ! --===============1008454738728940108==-- From commits@source.squeak.org Sat Feb 24 19:42:42 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1293.mcz Date: Sat, 24 Feb 2024 19:42:36 +0000 Message-ID: <20240224194240.E0A35583DC2@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4951262843546140082==" --===============4951262843546140082== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1293.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1293 Author: ct Time: 8 January 2020, 11:11:21.431206 am UUID: 86f4d70b-c53c-5a45-97f3-1bff2d65cdb4 Ancestors: Kernel-nice.1292 Elaborate method comment in Object >> #copyFrom: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-nice.1292 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: Object>>copyFrom: (in category 'copying') ----- copyFrom: anotherObject + "Copy to myself all instance variables I have in common with anotherObject= , i. e. those which have the same index in both class definitions. This is da= ngerous because it ignores an object's control over its own inst vars." - "Copy to myself all instance variables I have in common with anotherObject= . This is dangerous because it ignores an object's control over its own inst= vars. " =20 | mine his | mine :=3D self class allInstVarNames. his :=3D anotherObject class allInstVarNames. 1 to: (mine size min: his size) do: [:ind | (mine at: ind) =3D (his at: ind) ifTrue: [ self instVarAt: ind put: (anotherObject instVarAt: ind)]]. self class isVariable & anotherObject class isVariable ifTrue: [ 1 to: (self basicSize min: anotherObject basicSize) do: [:ind | self basicAt: ind put: (anotherObject basicAt: ind)]].! Item was changed: ----- Method: Object>>copySameFrom: (in category 'copying') ----- copySameFrom: otherObject + "Copy to myself all instance variables named the same in otherObject. This= is dangerous because it ignores an object's control over its own inst vars." - "Copy to myself all instance variables named the same in otherObject. - This ignores otherObject's control over its own inst vars." =20 | myInstVars otherInstVars | myInstVars :=3D self class allInstVarNames. otherInstVars :=3D otherObject class allInstVarNames. myInstVars doWithIndex: [:each :index | | match | (match :=3D otherInstVars indexOf: each) > 0 ifTrue: [self instVarAt: index put: (otherObject instVarAt: match)]]. 1 to: (self basicSize min: otherObject basicSize) do: [:i | self basicAt: i put: (otherObject basicAt: i)]. ! --===============4951262843546140082==-- From commits@source.squeak.org Sat Feb 24 20:33:39 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: KernelTests-ct.452.mcz Date: Sat, 24 Feb 2024 20:33:34 +0000 Message-ID: <20240224203338.1F6BA5826A3@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3198235298497682450==" --===============3198235298497682450== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of KernelTests to project The Trunk: http://source.squeak.org/trunk/KernelTests-ct.452.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: KernelTests-ct.452 Author: ct Time: 24 February 2024, 9:33:33.756459 pm UUID: bd37e2b7-1de0-ac4f-8130-78ccabfdb249 Ancestors: KernelTests-ct.451, KernelTests-ct.376, KernelTests-ct.387 KernelTests-ct.387: Adds regression test for Kernel-ct.1355 (source logging after SyntaxError). Revision: Document side effect to changes file. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against KernelTests-ct.451= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: ClassDescriptionTest>>testLogSourceAfterReparseSyntaxError (i= n category 'tests') ----- + testLogSourceAfterReparseSyntaxError +=20 + | class source | + SystemChangeNotifier uniqueInstance doSilently: "NB: this silences logging= of subclass creation/deletion but not logging of #compile:, which is part of= the functionality under test" + [[class :=3D Object newSubclass. + source :=3D 'foo [x'. + [class compile: source] + on: SyntaxErrorNotification do: [:error | + error retryWithNewSource: (source :=3D source , ']')]. + self assert: source equals: (class sourceCodeAt: #foo) asString] + ensure: [class removeFromSystem]].! --===============3198235298497682450==-- From commits@source.squeak.org Sat Feb 24 20:33:49 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1554.mcz Date: Sat, 24 Feb 2024 20:33:43 +0000 Message-ID: <20240224203348.BA13F583D9F@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8086720304345315460==" --===============8086720304345315460== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1554.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1554 Author: ct Time: 24 February 2024, 9:33:37.855459 pm UUID: 8840e255-a1eb-3044-85ed-e7186b5c252f Ancestors: Kernel-ct.1553, Kernel-ct.1301, Kernel-ct.1355 Complements Compiler-ct.496. Merges Kernel-ct.1355. Revision: If parserClass = does not store sourceText in the methodNode, preserve original formatting fro= m the cue. Reuse existing #stringToLog like Compiler>>#evaluateCue:ifFail:log= ged:. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-ct.1553 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: ClassDescription>>compileCue:classified:withStamp:logSource: = (in category 'compiling') ----- compileCue: compilationCue classified: category withStamp: changeStamp logS= ource: logSource =20 | methodAndNode methodNode selector | methodNode :=3D self newCompiler compile: compilationCue ifFail: [^nil]. methodAndNode :=3D CompiledMethodWithNode=20 generateMethodFromNode: methodNode=20 trailer: (compilationCue methodTrailer ifNil: [self defaultMethodTrailerIfLogSource: logSource]). selector :=3D methodAndNode selector. logSource ifTrue: [self + logMethodSource: (methodNode basicSourceText ifNil: [compilationCue stri= ngToLog]) "honor possible source updates (e.g., due to ReparseAfterSourceEdit= ing)" - logMethodSource: compilationCue source forMethodWithNode: methodAndNode=20 inCategory: category withStamp: changeStamp notifying: compilationCue requestor. RecentMessages default recordSelector: selector forClass: methodAndNode method methodClass inEnvironment: compilationCue environment]. self addAndClassifySelector: selector withMethod: methodAndNode method inProtocol: category notifying: compilationCue requestor. self instanceSide noteCompilationOf: selector meta: self isClassSide. ^selector! --===============8086720304345315460==-- From commits@source.squeak.org Sat Feb 24 20:33:57 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Compiler-ct.496.mcz Date: Sat, 24 Feb 2024 20:33:49 +0000 Message-ID: <20240224203355.A20B2583E4C@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5832182007502066843==" --===============5832182007502066843== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Compiler to project The Trunk: http://source.squeak.org/trunk/Compiler-ct.496.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Compiler-ct.496 Author: ct Time: 24 February 2024, 9:33:48.264459 pm UUID: 8600e29a-71b6-3347-9990-efef5c84e76d Ancestors: Compiler-mt.495 Fixes source logging after fixing a syntax error. In the past, the old source= was stored in the logs instead of the new one. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Compiler-mt.495 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: Compiler>>compiledMethodFor:in:to:notifying:ifFail: (in categ= ory 'public access') ----- compiledMethodFor: textOrStream in: aContext to: receiver notifying: aReque= stor ifFail: failBlock - "Compiles the sourceStream into a parse tree, then generates code - into a method, and answers it. If receiver is not nil, then the text can - refer to instance variables of that receiver (the Inspector uses this). - If aContext is not nil, the text can refer to temporaries in that context - (the Debugger uses this). If aRequestor is not nil, then it will receive = a=20 - notify:at: message before the attempt to evaluate is aborted." =20 + ^ self + compiledMethodFor: textOrStream + in: aContext + to: receiver - | methodNode method | - methodNode :=3D self - compileNoPattern: textOrStream - in: (self classForReceiver: receiver context: aContext) - context: aContext notifying: aRequestor + ifFail: failBlock + logged: false! - ifFail: [^failBlock value]. - method :=3D self interactive - ifTrue: [ methodNode generateWithTempNames ]=20 - ifFalse: [ methodNode generate ]. - ^method! Item was changed: ----- Method: Compiler>>compiledMethodFor:in:to:notifying:ifFail:logged: (i= n category 'public access logging') ----- compiledMethodFor: textOrStream in: aContext to: receiver notifying: aReque= stor ifFail: failBlock logged: logFlag "Compiles the sourceStream into a parse tree, then generates code into a method, and answers it. If receiver is not nil, then the text can refer to instance variables of that receiver (the Inspector uses this). If aContext is not nil, the text can refer to temporaries in that context (the Debugger uses this). If aRequestor is not nil, then it will receive = a=20 notify:at: message before the attempt to evaluate is aborted." =20 + | methodNode method | + methodNode :=3D self + compileNoPattern: textOrStream + in: (self classForReceiver: receiver context: aContext) + context: aContext - | method | - method :=3D self - compiledMethodFor: textOrStream - in: aContext - to: receiver notifying: aRequestor ifFail: [^failBlock value]. + method :=3D self interactive + ifTrue: [ methodNode generateWithTempNames ]=20 + ifFalse: [ methodNode generate ]. + =09 logFlag ifTrue: + [SystemChangeNotifier uniqueInstance + evaluated: (methodNode basicSourceText ifNil: [cue stringToLog]) "honor = possible source updates (e.g., due to ReparseAfterSourceEditing)" + context: aContext]. + =09 - [SystemChangeNotifier uniqueInstance evaluated: cue stringToLog context: = aContext]. ^method! Item was changed: ----- Method: Compiler>>evaluateCue:ifFail: (in category 'private') ----- evaluateCue: aCue ifFail: failBlock - "Compiles the cue source into a parse tree, then generates code into - a method. Finally, the compiled method is invoked from here via withArgs:= executeMethod:, hence the system no longer creates Doit method - litter on errors." =20 + ^ self + evaluateCue: aCue + ifFail: failBlock + logged: false! - | methodNode method value | - methodNode :=3D self compileCue: aCue noPattern: true ifFail: [^failBlock = value]. -=20 - method :=3D self interactive - ifTrue: [methodNode generateWithTempNames] - ifFalse: [methodNode generate]. -=20 - value :=3D cue receiver - withArgs: (cue context ifNil: [#()] ifNotNil: [{cue context}]) - executeMethod: method. - ^ value - ! Item was changed: ----- Method: Compiler>>evaluateCue:ifFail:logged: (in category 'private') = ----- evaluateCue: aCue ifFail: failBlock logged: logFlag "Compiles the cue source into a parse tree, then generates code into a method. Finally, the compiled method is invoked from here via withArgs:= executeMethod:, hence the system no longer creates Doit method litter on errors." =20 + | methodNode method value | + methodNode :=3D self compileCue: aCue noPattern: true ifFail: [^failBlock = value]. +=20 + method :=3D self interactive + ifTrue: [methodNode generateWithTempNames] + ifFalse: [methodNode generate]. +=20 + value :=3D cue receiver + withArgs: (cue context ifNil: [#()] ifNotNil: [{cue context}]) + executeMethod: method. + =09 - | value | - value :=3D self evaluateCue: aCue ifFail: [^failBlock value]. logFlag ifTrue: + [SystemChangeNotifier uniqueInstance + evaluated: (methodNode basicSourceText ifNil: [cue stringToLog]) "honor = possible source updates (e.g., due to ReparseAfterSourceEditing)" + context: cue context]. + =09 + ^ value! - [SystemChangeNotifier uniqueInstance evaluated: cue stringToLog context: = cue context]. - ^ value - ! Item was added: + ----- Method: MethodNode>>basicSourceText (in category 'printing') ----- + basicSourceText +=20 + ^ sourceText! --===============5832182007502066843==-- From commits@source.squeak.org Sat Feb 24 20:37:36 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: KernelTests-ct.387.mcz Date: Sat, 24 Feb 2024 20:37:32 +0000 Message-ID: <20240224203734.DC20E583D83@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5954405874293456326==" --===============5954405874293456326== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of KernelTests to project The Trunk: http://source.squeak.org/trunk/KernelTests-ct.387.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: KernelTests-ct.387 Author: ct Time: 24 October 2020, 12:40:40.526058 am UUID: aa73c56f-88e1-3b4d-9d59-fb29df3363a7 Ancestors: KernelTests-ul.386 Adds regression test for Kernel-ct.1355 (source logging after SyntaxError). S= hould I invest further complexity into this test for the purpose of keeping t= he production source logs clean? =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against KernelTests-ul.386= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: ClassDescriptionTest>>testLogSourceAfterReparseSyntaxError (i= n category 'testing') ----- + testLogSourceAfterReparseSyntaxError +=20 + | class source | + SystemChangeNotifier uniqueInstance doSilently: [[ + class :=3D Object newSubclass. + source :=3D 'foo [x'. + [class compile: source] + on: SyntaxErrorNotification do: [:error | + error resume: (source :=3D source , ']')]. + self assert: source equals: (class sourceCodeAt: #foo) asString. + ] ensure: [class removeFromSystem]].! Item was changed: + ----- Method: ClassDescriptionTest>>testOrganization (in category 'testing'= ) ----- - ----- Method: ClassDescriptionTest>>testOrganization (in category 'tests') = ----- testOrganization =20 | aClassOrganizer | aClassOrganizer :=3D ClassDescription organization. self assert: (aClassOrganizer isKindOf: ClassOrganizer).! --===============5954405874293456326==-- From commits@source.squeak.org Sat Feb 24 20:37:57 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1355.mcz Date: Sat, 24 Feb 2024 20:37:51 +0000 Message-ID: <20240224203754.F400E583E63@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7818267855814769616==" --===============7818267855814769616== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1355.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1355 Author: ct Time: 24 October 2020, 12:39:11.860058 am UUID: 32ca6b45-a632-e743-8a51-10d5d9dee1b3 Ancestors: Kernel-mt.1353 Fixes source logging when fixing a SyntaxError. In the past, the old source w= as stored in the logs instead of the new one. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-mt.1353 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: ClassDescription>>compileCue:classified:withStamp:logSource: = (in category 'compiling') ----- compileCue: compilationCue classified: category withStamp: changeStamp logS= ource: logSource =20 | methodAndNode methodNode selector | methodNode :=3D self newCompiler compile: compilationCue ifFail: [^nil]. methodAndNode :=3D CompiledMethodWithNode=20 generateMethodFromNode: methodNode=20 trailer: (compilationCue methodTrailer ifNil: [self defaultMethodTrailerIfLogSource: logSource]). selector :=3D methodAndNode selector. logSource ifTrue: [self + logMethodSource: methodNode sourceText - logMethodSource: compilationCue source forMethodWithNode: methodAndNode=20 inCategory: category withStamp: changeStamp notifying: compilationCue requestor. RecentMessages default recordSelector: selector forClass: methodAndNode method methodClass inEnvironment: compilationCue environment]. self addAndClassifySelector: selector withMethod: methodAndNode method inProtocol: category notifying: compilationCue requestor. self instanceSide noteCompilationOf: selector meta: self isClassSide. ^selector! --===============7818267855814769616==-- From commits@source.squeak.org Sat Feb 24 21:40:12 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Treated Inbox: Kernel-ct.1409.mcz Date: Sat, 24 Feb 2024 21:40:06 +0000 Message-ID: <20240224214009.EAEC5583DAF@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7260170485893939405==" --===============7260170485893939405== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Treated Inbo= x: http://source.squeak.org/treated/Kernel-ct.1409.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1409 Author: ct Time: 22 August 2021, 6:18:06.141465 pm UUID: 003f761f-f99d-c245-a431-dcf1cb8405ba Ancestors: Kernel-eem.1408 Fixes a simulation bug when returning from a sender that is a bottom context. Examples to reproduce: - sender :=3D thisContext swapSender: nil. ^1 - sender :=3D thisContext swapSender: nil. true ifTrue: [^ 1]. - [sender :=3D thisContext swapSender: nil. true ifTrue: [^ 1]] value. Without this patch, #return:from: would return nil instead of activating #can= notReturn: so simulating instead of executing e.g. the first example would no= t open the expected "computation terminated" debugger. See http://lists.squea= kfoundation.org/pipermail/squeak-dev/2021-May/215762.html for more informatio= n. Thanks to Jaromir (jar) for pointing to this bug! =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-eem.1408 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: Context>>return:from: (in category 'instruction decoding') --= --- return: value from: aSender=20 "For simulation. Roll back self to aSender and return value from it. Exe= cute any unwind blocks on the way. ASSUMES aSender is a sender of self" =20 | newTop | aSender isDead ifTrue: [^self send: #cannotReturn: to: self with: {value}]. newTop :=3D aSender sender. + newTop ifNil: + [^self send: #cannotReturn: to: self with: {value}]. (self findNextUnwindContextUpTo: newTop) ifNotNil: [:unwindProtectCtxt| ^self send: #aboutToReturn:through: to: self with: {value. unwindProtect= Ctxt}]. self releaseTo: newTop. newTop ifNotNil: [newTop push: value]. ^newTop! --===============7260170485893939405==-- From commits@source.squeak.org Sun Feb 25 18:57:32 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1555.mcz Date: Sun, 25 Feb 2024 18:57:15 +0000 Message-ID: <20240225185729.889045826B2@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7033992321682034628==" --===============7033992321682034628== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1555.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1555 Author: ct Time: 25 February 2024, 7:56:23.908593 pm UUID: 45f6b27d-e825-c34b-a540-5c173c78c951 Ancestors: Kernel-ct.1554, Kernel-ct.1356, Kernel-ct.1408, Kernel-ct.1450, Ke= rnel-ct.1455 Merge commit. Kernel-ct.1301: Documents the small but essential difference between #sendTo: and #sentTo:. Kernel-ct.1356: Fixes and refactors ClassBuilder cleanupAndCheckClassHierarchy which was bro= ken due to a missing #informUserDuring: implementation. Also adds progress ba= rs during the operation. Kernel-ct.1408: Proposal: Show nested exception in the description of BrokenPromise. =09 Revision: Honor the fact that Promise errors are not necessarily exceptions.= Reuse #messageText rather than overriding #description. Kernel-ct.1450: Updates comment in TimedOut. Kernel-ct.1455: Adds basic support for #acceptsLoggingOfCompilation to class comments by all= owing strings in BasicClassOrganizer classComment. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-ct.1554 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: BasicClassOrganizer>>classComment (in category 'accessing') -= ---- classComment classComment ifNil: [^ '']. + (classComment isString + or: [classComment isText]) + ifTrue: [^ classComment]. + ^ classComment text + ifNil: ['']! - ^ classComment text ifNil: ['']! Item was changed: ----- Method: BasicClassOrganizer>>classComment:stamp: (in category 'access= ing') ----- classComment: aString stamp: aStamp + "Store the comment, aString, associated with the object that refers to the= receiver. PRIVATE!! Clients should use aClass classComment: instead." - "Store the comment, aString, associated with the object that refers to the= receiver." =20 self commentStamp: aStamp. (aString isKindOf: RemoteString)=20 ifTrue: [classComment :=3D aString] ifFalse: [(aString =3D=3D nil or: [aString size =3D 0]) ifTrue: [classComment :=3D nil] ifFalse: + [classComment :=3D aString]] - [self error: 'use aClass classComment:'. - classComment :=3D RemoteString newString: aString onFileNumber: 2]] "Later add priorSource and date and initials?"! Item was changed: ----- Method: BasicClassOrganizer>>commentRemoteStr (in category 'accessing= ') ----- commentRemoteStr + ^ (classComment isKindOf: RemoteString) + ifTrue: [classComment]! - ^ classComment! Item was changed: ----- Method: BasicClassOrganizer>>fileOutCommentOn:moveSource:toFile: (in = category 'fileIn/Out') ----- fileOutCommentOn: aFileStream moveSource: moveSource toFile: fileIndex "Copy the class comment to aFileStream. If moveSource is true (as in comp= ressChanges or compressSources, then update classComment to point to the new = file." | fileComment | + self hasNoComment ifTrue: [^ self]. + =09 + aFileStream cr. + fileComment :=3D RemoteString + newString: self classComment + onFileNumber: fileIndex + toFile: aFileStream. + moveSource ifTrue: [classComment :=3D fileComment].! - classComment ifNotNil:=20 - [aFileStream cr. - fileComment :=3D RemoteString newString: classComment text - onFileNumber: fileIndex toFile: aFileStream. - moveSource ifTrue: [classComment :=3D fileComment]]! Item was changed: ----- Method: BasicClassOrganizer>>moveChangedCommentToFile:numbered: (in c= ategory 'fileIn/Out') ----- moveChangedCommentToFile: aFileStream numbered: fileIndex=20 "If the comment is in the changes file, then move it to a new file." =20 + (self commentRemoteStr ~~ nil and: [classComment sourceFileNumber > 1]) if= True:=20 - (classComment ~~ nil and: [classComment sourceFileNumber > 1]) ifTrue:=20 [self fileOutCommentOn: aFileStream moveSource: true toFile: fileIndex]! Item was added: + ----- Method: BrokenPromise>>error (in category 'accessing') ----- + error +=20 + ^ promise ifNotNil: [promise error]! Item was added: + ----- Method: BrokenPromise>>messageText (in category 'accessing') ----- + messageText +=20 + ^ messageText ifNil: + [self error ifNotNil: [:error | + error asString]]! Item was changed: ----- Method: ClassBuilder class>>checkClassHierarchyConsistency (in catego= ry 'cleanup obsolete classes') ----- checkClassHierarchyConsistency "Check the consistency of the class hierarchy. The class hierarchy is cons= istent if the following two logical equivalences hold for classes A and B: - B is obsolete and 'B superclass' yields A <--> 'A obsoleteSubclasses' = contains B - B is not obsolete and 'B superclass' yields A <--> 'A subclasses' cont= ains B" +=20 + Transcript cr; show: 'Start checking the class hierarchy...'. + Smalltalk garbageCollect. + =09 + Metaclass allInstances + do: [:meta | + meta allInstances do: [:each | self checkClassHierarchyConsistencyFor: e= ach]. + self checkClassHierarchyConsistencyFor: meta] + displayingProgress: 'Validating class hierarchy' translated. + =09 + Transcript show: 'OK'.! - self informUserDuring:[:bar| - self checkClassHierarchyConsistency: bar. - ].! Item was removed: - ----- Method: ClassBuilder class>>checkClassHierarchyConsistency: (in categ= ory 'cleanup obsolete classes') ----- - checkClassHierarchyConsistency: informer - "Check the consistency of the class hierarchy. The class hierarchy is cons= istent if the following - two logical equivalences hold for classes A and B: - - B is obsolete and 'B superclass' yields A <--> 'A obsoleteSubclasses' = contains B - - B is not obsolete and 'B superclass' yields A <--> 'A subclasses' cont= ains B" - | classes | - Transcript cr; show: 'Start checking the class hierarchy...'. - Smalltalk garbageCollect. - classes :=3D Metaclass allInstances. - classes keysAndValuesDo: [:index :meta | - informer value:'Validating class hierarchy ', (index * 100 // classes siz= e) printString,'%'. - meta allInstances do: [:each | self checkClassHierarchyConsistencyFor: ea= ch]. - self checkClassHierarchyConsistencyFor: meta. - ]. - Transcript show: 'OK'.! Item was changed: ----- Method: ClassBuilder class>>cleanupAndCheckClassHierarchy (in categor= y 'cleanup obsolete classes') ----- cleanupAndCheckClassHierarchy "Makes the class hierarchy consistent and removes obsolete classes from th= e SystemDictionary. Afterwards it checks whether the hierarchy is really consistent." +=20 + Project uiManager informUser: 'Cleaning up class hierarchy...' translated = during: [ + Transcript cr; show: '*** Before cleaning up ***'. + self countReallyObsoleteClassesAndMetaclasses. + self cleanupClassHierarchy. + self checkClassHierarchyConsistency. + Transcript cr; cr; show: '*** After cleaning up ***'. + self countReallyObsoleteClassesAndMetaclasses].! - self informUserDuring:[:bar| - self cleanupAndCheckClassHierarchy: bar. - ]. - ! Item was removed: - ----- Method: ClassBuilder class>>cleanupAndCheckClassHierarchy: (in catego= ry 'cleanup obsolete classes') ----- - cleanupAndCheckClassHierarchy: informer - "Makes the class hierarchy consistent and removes obsolete classes from th= e SystemDictionary. - Afterwards it checks whether the hierarchy is really consistent." -=20 - Transcript cr; show: '*** Before cleaning up ***'. - self countReallyObsoleteClassesAndMetaclasses. - self cleanupClassHierarchy: informer. - self checkClassHierarchyConsistency: informer. - Transcript cr; cr; show: '*** After cleaning up ***'. - self countReallyObsoleteClassesAndMetaclasses.! Item was changed: ----- Method: ClassBuilder class>>cleanupClassHierarchy (in category 'clean= up obsolete classes') ----- cleanupClassHierarchy "Makes the class hierarchy consistent and removes obsolete classes from th= e SystemDictionary." +=20 + Transcript cr; show: 'Start fixing the class hierarchy and cleaning up...'. + Smalltalk garbageCollect. + =09 + Metaclass allInstances + do: [:meta | + "Check classes before metaclasses (because Metaclass>>isObsolete checks = whether the related class is obsolete)" + meta allInstances do: [:each | self cleanupClassHierarchyFor: each]. + self cleanupClassHierarchyFor: meta] + displayingProgress: 'Fixing class hierarchy' translated. + =09 + Transcript show: 'DONE'.! - self informUserDuring:[:bar| - self cleanupClassHierarchy: bar. - ].! Item was removed: - ----- Method: ClassBuilder class>>cleanupClassHierarchy: (in category 'clea= nup obsolete classes') ----- - cleanupClassHierarchy: informer - "Makes the class hierarchy consistent and removes obsolete classes from th= e SystemDictionary." - | classes | - Transcript cr; show: 'Start fixing the class hierarchy and cleaning up...'. - Smalltalk garbageCollect. - classes :=3D Metaclass allInstances. - classes keysAndValuesDo: [:index :meta | - informer value:'Fixing class hierarchy ', (index * 100 // classes size) = printString,'%'. - "Check classes before metaclasses (because Metaclass>>isObsolete - checks whether the related class is obsolete)" - meta allInstances do: [:each | self cleanupClassHierarchyFor: each]. - self cleanupClassHierarchyFor: meta. - ]. - Transcript show: 'DONE'.! Item was changed: ----- Method: ClassDescription>>classComment:stamp: (in category 'fileIn/Ou= t') ----- classComment: aString stamp: aStamp "Store the comment, aString or Text or RemoteString, associated with the c= lass we are organizing. Empty string gets stored only if had a non-empty one= before." =20 - | ptr header file oldCommentRemoteStr | (aString isKindOf: RemoteString) ifTrue: [SystemChangeNotifier uniqueInstance classCommented: self. ^ self organization classComment: aString stamp: aStamp]. =20 + self acceptsLoggingOfCompilation + ifTrue: + [| ptr header file oldCommentRemoteStr | + oldCommentRemoteStr :=3D self organization commentRemoteStr. + (aString size =3D 0) & (oldCommentRemoteStr =3D=3D nil) ifTrue: + ["never had a class comment, no need to write empty string out" + ^ self organization classComment: nil]. + =09 + ptr :=3D oldCommentRemoteStr ifNil: [0] ifNotNil: [oldCommentRemoteStr s= ourcePointer]. + SourceFiles ifNotNil: [(file :=3D SourceFiles at: 2) ifNotNil: + [file setToEnd; cr; nextPut: $!!. "directly" + "Should be saying (file command: ''H3'') for HTML, but ignoring it here" + header :=3D String streamContents: [:strm | strm nextPutAll: self name; + nextPutAll: ' commentStamp: '. + aStamp storeOn: strm. + strm nextPutAll: ' prior: '; nextPutAll: ptr printString]. + file nextChunkPut: header]]. + self organization classComment: (RemoteString newString: aString onFileN= umber: 2) stamp: aStamp. + file ifNotNil: [ InMidstOfFileinNotification signal ifFalse: [ file flus= h ] ]] + ifFalse: + [self organization classComment: aString stamp: aStamp]. + =09 + SystemChangeNotifier uniqueInstance classCommented: self.! - oldCommentRemoteStr :=3D self organization commentRemoteStr. - (aString size =3D 0) & (oldCommentRemoteStr =3D=3D nil) ifTrue: [^ self or= ganization classComment: nil]. - "never had a class comment, no need to write empty string out" -=20 - ptr :=3D oldCommentRemoteStr ifNil: [0] ifNotNil: [oldCommentRemoteStr sou= rcePointer]. - SourceFiles ifNotNil: [(file :=3D SourceFiles at: 2) ifNotNil: - [file setToEnd; cr; nextPut: $!!. "directly" - "Should be saying (file command: 'H3') for HTML, but ignoring it here" - header :=3D String streamContents: [:strm | strm nextPutAll: self name; - nextPutAll: ' commentStamp: '. - aStamp storeOn: strm. - strm nextPutAll: ' prior: '; nextPutAll: ptr printString]. - file nextChunkPut: header]]. - self organization classComment: (RemoteString newString: aString onFileNum= ber: 2) stamp: aStamp. - file ifNotNil: [ InMidstOfFileinNotification signal ifFalse: [ file flush = ] ]. - SystemChangeNotifier uniqueInstance classCommented: self. - ! Item was changed: ----- Method: Message>>sendTo: (in category 'sending') ----- + sendTo: receiverObject + "Answer the result of sending this message to receiverObject" - sendTo: receiver - "answer the result of sending this message to receiver" =20 + ^ receiverObject perform: selector withArguments: args! - ^ receiver perform: selector withArguments: args! Item was changed: ----- Method: Message>>sentTo: (in category 'sending') ----- + sentTo: receiverObject + "Answer the result of sending this message to receiver. Kind of private!! = To send the message to a different receiver (for example, via #doesNotUnderst= and:), use #sendTo: instead." - sentTo: receiver - "answer the result of sending this message to receiver" =20 + ^ lookupClass =3D=3D nil + ifTrue: [receiverObject perform: selector withArguments: args] + ifFalse: [receiverObject perform: selector withArguments: args inSupercla= ss: lookupClass]! - lookupClass =3D=3D nil - ifTrue: [^ receiver perform: selector withArguments: args] - ifFalse: [^ receiver perform: selector withArguments: args inSuperclass: = lookupClass]! Item was changed: Notification subclass: #TimedOut instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Kernel-Exceptions'! =20 + !TimedOut commentStamp: 'ct 3/25/2022 00:01' prior: 0! + I am signalled by BlockClosure>>#valueWithin:onTimeout: if the receiving bl= ock takes too long to execute. - !TimedOut commentStamp: 'brp 10/21/2004 17:47' prior: 0! - I am signalled by #duration:timeoutDo: if the receiving block takes too lon= g to execute. =20 - I am signalled by a watchdog process spawned by #duration:timeoutDo: and ca= ught in the same method.=20 -=20 I am not intended to be used elsewhere.! --===============7033992321682034628==-- From commits@source.squeak.org Sun Feb 25 19:01:05 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1356.mcz Date: Sun, 25 Feb 2024 19:00:52 +0000 Message-ID: <20240225190103.02AF85826B2@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5885778135525459134==" --===============5885778135525459134== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1356.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1356 Author: ct Time: 28 October 2020, 9:05:21.976652 pm UUID: 27e8ca85-1191-5b4b-aa8c-92b65e01af50 Ancestors: Kernel-eem.1354 Fixes and refactors ClassBuilder cleanupAndCheckClassHierarchy which was brok= en due to a missing #informUserDuring: implementation. Also adds progress bar= s during the operation. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-eem.1354 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: ClassBuilder class>>checkClassHierarchyConsistency (in catego= ry 'cleanup obsolete classes') ----- checkClassHierarchyConsistency "Check the consistency of the class hierarchy. The class hierarchy is cons= istent if the following two logical equivalences hold for classes A and B: - B is obsolete and 'B superclass' yields A <--> 'A obsoleteSubclasses' = contains B - B is not obsolete and 'B superclass' yields A <--> 'A subclasses' cont= ains B" +=20 + Transcript cr; show: 'Start checking the class hierarchy...'. + Smalltalk garbageCollect. + =09 + Metaclass allInstances + do: [:meta | + meta allInstances do: [:each | self checkClassHierarchyConsistencyFor: e= ach]. + self checkClassHierarchyConsistencyFor: meta] + displayingProgress: 'Validating class hierarchy' translated. + =09 + Transcript show: 'OK'.! - self informUserDuring:[:bar| - self checkClassHierarchyConsistency: bar. - ].! Item was removed: - ----- Method: ClassBuilder class>>checkClassHierarchyConsistency: (in categ= ory 'cleanup obsolete classes') ----- - checkClassHierarchyConsistency: informer - "Check the consistency of the class hierarchy. The class hierarchy is cons= istent if the following - two logical equivalences hold for classes A and B: - - B is obsolete and 'B superclass' yields A <--> 'A obsoleteSubclasses' = contains B - - B is not obsolete and 'B superclass' yields A <--> 'A subclasses' cont= ains B" - | classes | - Transcript cr; show: 'Start checking the class hierarchy...'. - Smalltalk garbageCollect. - classes :=3D Metaclass allInstances. - classes keysAndValuesDo: [:index :meta | - informer value:'Validating class hierarchy ', (index * 100 // classes siz= e) printString,'%'. - meta allInstances do: [:each | self checkClassHierarchyConsistencyFor: ea= ch]. - self checkClassHierarchyConsistencyFor: meta. - ]. - Transcript show: 'OK'.! Item was changed: ----- Method: ClassBuilder class>>cleanupAndCheckClassHierarchy (in categor= y 'cleanup obsolete classes') ----- cleanupAndCheckClassHierarchy "Makes the class hierarchy consistent and removes obsolete classes from th= e SystemDictionary. Afterwards it checks whether the hierarchy is really consistent." +=20 + Project uiManager informUser: 'Cleaning up class hierarchy...' translated = during: [ + Transcript cr; show: '*** Before cleaning up ***'. + self countReallyObsoleteClassesAndMetaclasses. + self cleanupClassHierarchy. + self checkClassHierarchyConsistency. + Transcript cr; cr; show: '*** After cleaning up ***'. + self countReallyObsoleteClassesAndMetaclasses].! - self informUserDuring:[:bar| - self cleanupAndCheckClassHierarchy: bar. - ]. - ! Item was removed: - ----- Method: ClassBuilder class>>cleanupAndCheckClassHierarchy: (in catego= ry 'cleanup obsolete classes') ----- - cleanupAndCheckClassHierarchy: informer - "Makes the class hierarchy consistent and removes obsolete classes from th= e SystemDictionary. - Afterwards it checks whether the hierarchy is really consistent." -=20 - Transcript cr; show: '*** Before cleaning up ***'. - self countReallyObsoleteClassesAndMetaclasses. - self cleanupClassHierarchy: informer. - self checkClassHierarchyConsistency: informer. - Transcript cr; cr; show: '*** After cleaning up ***'. - self countReallyObsoleteClassesAndMetaclasses.! Item was changed: ----- Method: ClassBuilder class>>cleanupClassHierarchy (in category 'clean= up obsolete classes') ----- cleanupClassHierarchy "Makes the class hierarchy consistent and removes obsolete classes from th= e SystemDictionary." +=20 + Transcript cr; show: 'Start fixing the class hierarchy and cleaning up...'. + Smalltalk garbageCollect. + =09 + Metaclass allInstances + do: [:meta | + "Check classes before metaclasses (because Metaclass>>isObsolete checks = whether the related class is obsolete)" + meta allInstances do: [:each | self cleanupClassHierarchyFor: each]. + self cleanupClassHierarchyFor: meta] + displayingProgress: 'Fixing class hierarchy' translated. + =09 + Transcript show: 'DONE'.! - self informUserDuring:[:bar| - self cleanupClassHierarchy: bar. - ].! Item was removed: - ----- Method: ClassBuilder class>>cleanupClassHierarchy: (in category 'clea= nup obsolete classes') ----- - cleanupClassHierarchy: informer - "Makes the class hierarchy consistent and removes obsolete classes from th= e SystemDictionary." - | classes | - Transcript cr; show: 'Start fixing the class hierarchy and cleaning up...'. - Smalltalk garbageCollect. - classes :=3D Metaclass allInstances. - classes keysAndValuesDo: [:index :meta | - informer value:'Fixing class hierarchy ', (index * 100 // classes size) = printString,'%'. - "Check classes before metaclasses (because Metaclass>>isObsolete - checks whether the related class is obsolete)" - meta allInstances do: [:each | self cleanupClassHierarchyFor: each]. - self cleanupClassHierarchyFor: meta. - ]. - Transcript show: 'DONE'.! --===============5885778135525459134==-- From commits@source.squeak.org Sun Feb 25 19:06:11 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1408.mcz Date: Sun, 25 Feb 2024 19:05:50 +0000 Message-ID: <20240225190608.E4DAF583EB9@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4350386462141935286==" --===============4350386462141935286== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1408.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1408 Author: ct Time: 17 July 2021, 8:21:02.006197 pm UUID: 0b59b2d7-2dfe-6640-bc29-63e35699bc53 Ancestors: Kernel-mt.1406 Proposal: Show nested exception in the description of BrokenPromise. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-mt.1406 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: + ----- Method: BrokenPromise>>defaultAction (in category 'priv handling') --= --- - ----- Method: BrokenPromise>>defaultAction (in category 'as yet unclassifie= d') ----- defaultAction self messageText: 'Promise was rejected'. ^super defaultAction! Item was added: + ----- Method: BrokenPromise>>description (in category 'accessing') ----- + description +=20 + ^ String streamContents: [:stream | + stream nextPutAll: super description. + self exception ifNotNil: [:ex | + stream + nextPutAll: ': '; + nextPutAll: ex description]]! Item was added: + ----- Method: BrokenPromise>>exception (in category 'accessing') ----- + exception +=20 + ^ promise ifNotNil: [promise error]! Item was changed: + ----- Method: BrokenPromise>>isResumable (in category 'priv handling') ----- - ----- Method: BrokenPromise>>isResumable (in category 'as yet unclassified'= ) ----- isResumable ^ true! Item was changed: + ----- Method: BrokenPromise>>promise (in category 'accessing') ----- - ----- Method: BrokenPromise>>promise (in category 'as yet unclassified') --= --- promise ^ promise! Item was changed: + ----- Method: BrokenPromise>>promise: (in category 'accessing') ----- - ----- Method: BrokenPromise>>promise: (in category 'as yet unclassified') -= ---- promise: aPromise promise :=3D aPromise! --===============4350386462141935286==-- From commits@source.squeak.org Sun Feb 25 19:08:17 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1450.mcz Date: Sun, 25 Feb 2024 19:08:04 +0000 Message-ID: <20240225190815.3A595584042@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4732454811428361748==" --===============4732454811428361748== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1450.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1450 Author: ct Time: 25 March 2022, 12:03:45.256465 am UUID: 484c3944-1ae9-fa4b-888c-bacd59152bc5 Ancestors: Kernel-nice.1447 Updates comment in TimedOut. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-nice.1447 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: Notification subclass: #TimedOut instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Kernel-Exceptions'! =20 + !TimedOut commentStamp: 'ct 3/25/2022 00:01' prior: 0! + I am signalled by BlockClosure>>#valueWithin:onTimeout: if the receiving bl= ock takes too long to execute. - !TimedOut commentStamp: 'brp 10/21/2004 17:47' prior: 0! - I am signalled by #duration:timeoutDo: if the receiving block takes too lon= g to execute. =20 - I am signalled by a watchdog process spawned by #duration:timeoutDo: and ca= ught in the same method.=20 -=20 I am not intended to be used elsewhere.! --===============4732454811428361748==-- From commits@source.squeak.org Sun Feb 25 19:13:41 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1455.mcz Date: Sun, 25 Feb 2024 19:13:24 +0000 Message-ID: <20240225191338.7C9C1584086@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1425214848004105674==" --===============1425214848004105674== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1455.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1455 Author: ct Time: 2 April 2022, 6:03:46.669052 pm UUID: d86c9223-8db7-e541-96bd-cde0c9b7fb92 Ancestors: Kernel-ul.1454 Proposal: Adds basic support for #acceptsLoggingOfCompilation to class commen= ts by allowing strings in BasicClassOrganizer.classComment. With this change,= installing updates in a read-only image becomes more feasible. Please review. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-ul.1454 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: BasicClassOrganizer>>classComment (in category 'accessing') -= ---- classComment classComment ifNil: [^ '']. + (classComment isString + or: [classComment isText]) + ifTrue: [^ classComment]. + ^ classComment text + ifNil: ['']! - ^ classComment text ifNil: ['']! Item was changed: ----- Method: BasicClassOrganizer>>classComment:stamp: (in category 'access= ing') ----- classComment: aString stamp: aStamp + "Store the comment, aString, associated with the object that refers to the= receiver. PRIVATE!! Clients should use aClass classComment: instead." - "Store the comment, aString, associated with the object that refers to the= receiver." =20 self commentStamp: aStamp. (aString isKindOf: RemoteString)=20 ifTrue: [classComment :=3D aString] ifFalse: [(aString =3D=3D nil or: [aString size =3D 0]) ifTrue: [classComment :=3D nil] ifFalse: + [classComment :=3D aString]] - [self error: 'use aClass classComment:'. - classComment :=3D RemoteString newString: aString onFileNumber: 2]] "Later add priorSource and date and initials?"! Item was changed: ----- Method: BasicClassOrganizer>>commentRemoteStr (in category 'accessing= ') ----- commentRemoteStr + ^ (classComment isKindOf: RemoteString) + ifTrue: [classComment]! - ^ classComment! Item was changed: ----- Method: BasicClassOrganizer>>fileOutCommentOn:moveSource:toFile: (in = category 'fileIn/Out') ----- fileOutCommentOn: aFileStream moveSource: moveSource toFile: fileIndex "Copy the class comment to aFileStream. If moveSource is true (as in comp= ressChanges or compressSources, then update classComment to point to the new = file." | fileComment | + self hasNoComment ifTrue: [^ self]. + =09 + aFileStream cr. + fileComment :=3D RemoteString + newString: self classComment + onFileNumber: fileIndex + toFile: aFileStream. + moveSource ifTrue: [classComment :=3D fileComment].! - classComment ifNotNil:=20 - [aFileStream cr. - fileComment :=3D RemoteString newString: classComment text - onFileNumber: fileIndex toFile: aFileStream. - moveSource ifTrue: [classComment :=3D fileComment]]! Item was changed: ----- Method: BasicClassOrganizer>>moveChangedCommentToFile:numbered: (in c= ategory 'fileIn/Out') ----- moveChangedCommentToFile: aFileStream numbered: fileIndex=20 "If the comment is in the changes file, then move it to a new file." =20 + (self commentRemoteStr ~~ nil and: [classComment sourceFileNumber > 1]) if= True:=20 - (classComment ~~ nil and: [classComment sourceFileNumber > 1]) ifTrue:=20 [self fileOutCommentOn: aFileStream moveSource: true toFile: fileIndex]! Item was changed: ----- Method: ClassDescription>>classComment:stamp: (in category 'fileIn/Ou= t') ----- classComment: aString stamp: aStamp "Store the comment, aString or Text or RemoteString, associated with the c= lass we are organizing. Empty string gets stored only if had a non-empty one= before." =20 - | ptr header file oldCommentRemoteStr | (aString isKindOf: RemoteString) ifTrue: [SystemChangeNotifier uniqueInstance classCommented: self. ^ self organization classComment: aString stamp: aStamp]. =20 + self acceptsLoggingOfCompilation + ifTrue: + [| ptr header file oldCommentRemoteStr | + oldCommentRemoteStr :=3D self organization commentRemoteStr. + (aString size =3D 0) & (oldCommentRemoteStr =3D=3D nil) ifTrue: + ["never had a class comment, no need to write empty string out" + ^ self organization classComment: nil]. + =09 + ptr :=3D oldCommentRemoteStr ifNil: [0] ifNotNil: [oldCommentRemoteStr s= ourcePointer]. + SourceFiles ifNotNil: [(file :=3D SourceFiles at: 2) ifNotNil: + [file setToEnd; cr; nextPut: $!!. "directly" + "Should be saying (file command: ''H3'') for HTML, but ignoring it here" + header :=3D String streamContents: [:strm | strm nextPutAll: self name; + nextPutAll: ' commentStamp: '. + aStamp storeOn: strm. + strm nextPutAll: ' prior: '; nextPutAll: ptr printString]. + file nextChunkPut: header]]. + self organization classComment: (RemoteString newString: aString onFileN= umber: 2) stamp: aStamp. + file ifNotNil: [ InMidstOfFileinNotification signal ifFalse: [ file flus= h ] ]] + ifFalse: + [self organization classComment: aString stamp: aStamp]. + =09 + SystemChangeNotifier uniqueInstance classCommented: self.! - oldCommentRemoteStr :=3D self organization commentRemoteStr. - (aString size =3D 0) & (oldCommentRemoteStr =3D=3D nil) ifTrue: [^ self or= ganization classComment: nil]. - "never had a class comment, no need to write empty string out" -=20 - ptr :=3D oldCommentRemoteStr ifNil: [0] ifNotNil: [oldCommentRemoteStr sou= rcePointer]. - SourceFiles ifNotNil: [(file :=3D SourceFiles at: 2) ifNotNil: - [file setToEnd; cr; nextPut: $!!. "directly" - "Should be saying (file command: 'H3') for HTML, but ignoring it here" - header :=3D String streamContents: [:strm | strm nextPutAll: self name; - nextPutAll: ' commentStamp: '. - aStamp storeOn: strm. - strm nextPutAll: ' prior: '; nextPutAll: ptr printString]. - file nextChunkPut: header]]. - self organization classComment: (RemoteString newString: aString onFileNum= ber: 2) stamp: aStamp. - file ifNotNil: [ InMidstOfFileinNotification signal ifFalse: [ file flush = ] ]. - SystemChangeNotifier uniqueInstance classCommented: self. - ! --===============1425214848004105674==-- From commits@source.squeak.org Sun Feb 25 19:27:27 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1556.mcz Date: Sun, 25 Feb 2024 19:27:11 +0000 Message-ID: <20240225192725.825FA58407E@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1180474948183008703==" --===============1180474948183008703== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1556.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1556 Author: ct Time: 25 February 2024, 8:26:48.901593 pm UUID: 929047e6-a708-3540-97c5-aec212d87203 Ancestors: Kernel-ct.1555, Kernel-ct.1420, Kernel-ct.1451, Kernel-ct.1449, Ke= rnel-ct.1490, Kernel-ct.1546, Kernel-ct.1547, Kernel-ct.1548 Merges several simulation fixes from the inbox. As always, please refer to th= e original versions to read their full messages. Kernel-ct.1420: Aligns the error code for primitive 118 (primitiveDoPrimitiveWithArgs) durin= g simulation with what the VM returns. Kernel-ct.1451: Revises fallback code for primitive 188 (primitiveExecuteMethodArgsArray) in= Object>>#withArgs:executeMethod: to eliminate any side effects to the method= dictionary and add support for Objects as Methods. Kernel-ct.1449: Fixes arity checks for objects as methods in simulation of primitive 83 (pri= mitivePerform) and primitive 84 (primitivePerformWithArgs). Kernel-ct.1490: In code simulation of perform primitives (primitive 83 (primitivePerform) an= d primitive 84 (primitivePerformWithArgs)), do not check numArgs of the selec= tor or method to align behavior with VM. =09 Revision: Remove the same check from simulation of primitive 100 (primitiveP= erformInSuperclass) as well. Kernel-ct.1546: In the debugger/simulator, fixes stepping through #mustBeBoolean errors and = restarting from primitive methods that no longer fail. Kernel-ct.1547: When simulating #mustBeBoolean errors, send #mustBeBoolean instead of #mustB= eBooleanIn: just like the VM. Kernel-ct.1548: Resolves #mustBeBoolean errors for copies or proxies of true and false. =09 Revision: Improve documentation. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-ct.1555 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: Context>>doPrimitive:method:receiver:args: (in category 'priv= ate') ----- doPrimitive: primitiveIndex method: meth receiver: receiver args: arguments "Simulate a primitive method whose index is primitiveIndex. The simulated= receiver and arguments are given as arguments to this message. If successful, push res= ult and return resuming context, else ^ {errCode, PrimitiveFailToken}. Any primitive whi= ch provokes execution needs to be intercepted and simulated to avoid execution runnin= g away." =20 | value | "Judicious use of primitive 19 (a null primitive that doesn't do anything)= prevents the debugger from entering various run-away activities such as spawning a= new process, etc. Injudicious use results in the debugger not being able to = debug interesting code, such as the debugger itself. Hence use primitive 19 wi= th care :-)" "SystemNavigation new browseAllSelect: [:m| m primitive =3D 19]" primitiveIndex =3D 19 ifTrue: [ [self notify: ('The code being simulated is trying to control a process (= {1}). Process controlling cannot be simulated. If you proceed, things may hap= pen outside the observable area of the simulator.' translated format: {meth r= eference})] ifCurtailed: [self push: nil "Cheap fix of the context's internal state"= ]]. =09 ((primitiveIndex between: 201 and: 222) and: [(self objectClass: receiver) includesBehavior: BlockClosure]) ifTru= e: [(primitiveIndex =3D 206 or: [primitiveIndex =3D 208]) ifTrue: "[Full]BlockClosure>>valueWi= thArguments:" [^receiver simulateValueWithArguments: arguments first caller: self]. ((primitiveIndex between: 201 and: 209) "[Full]BlockClosure>>value[:v= alue:...]" or: [primitiveIndex between: 221 and: 222]) ifTrue: "[Full]BlockClosure= >>valueNoContextSwitch[:]" [^receiver simulateValueWithArguments: arguments caller: self]]. =20 primitiveIndex =3D 83 ifTrue: "afr 9/11/1998 19:50" "Object>>perform:[with= :...]" [| selector | selector :=3D arguments at: 1 ifAbsent: [^ self class primitiveFailTokenFor: #'bad argument']. - (selector isSymbol and: [arguments size - 1 ~=3D selector numArgs]) ifTru= e: - [^ self class primitiveFailTokenFor: #'bad number of arguments']. ^self send: selector to: receiver with: arguments allButFirst]. primitiveIndex =3D 84 ifTrue: "afr 9/11/1998 19:50 & eem 8/18/2009 17:04" = "Object>>perform:withArguments:" [| selector args | arguments size =3D 2 ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. selector :=3D arguments first. args :=3D arguments second. args isArray ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. - (selector isSymbol and: [args size ~=3D selector numArgs]) ifTrue: - [^ self class primitiveFailTokenFor: #'bad number of arguments']. ^self send: selector to: receiver with: args]. primitiveIndex =3D 100 ifTrue: "eem 8/18/2009 16:57" "Object>>perform:with= Arguments:inSuperclass:" [| rcvr selector args superclass | arguments size caseOf: { [3] -> [ rcvr :=3D receiver. selector :=3D arguments first. args :=3D arguments second. superclass :=3D arguments third]. [4] -> ["mirror primitive" rcvr :=3D arguments first. selector :=3D arguments second. args :=3D arguments third. superclass :=3D arguments fourth] } otherwise: [^ self class primitiveFailTokenFor: #'bad number of argument= s']. args isArray ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. - (selector isSymbol and: [args size ~=3D selector numArgs]) ifTrue: - [^ self class primitiveFailTokenFor: #'bad number of arguments']. ((self objectClass: rcvr) includesBehavior: superclass) ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. ^self send: selector to: rcvr with: args lookupIn: superclass]. =20 "Mutex>>primitiveEnterCriticalSection Mutex>>primitiveTestAndSetOwnershipOfCriticalSection" (primitiveIndex =3D 186 or: [primitiveIndex =3D 187]) ifTrue: [| effective | effective :=3D Processor activeProcess effectiveProcess. "active =3D=3D effective" value :=3D primitiveIndex =3D 186 ifTrue: [receiver primitiveEnterCriticalSectionOnBehalfOf: effective] ifFalse: [receiver primitiveTestAndSetOwnershipOfCriticalSectionOnBeha= lfOf: effective]. ^(self isPrimFailToken: value) ifTrue: [value] ifFalse: [self push: value]]. + =09 + (primitiveIndex =3D 188 or: [primitiveIndex =3D 189]) ifTrue: -=20 - primitiveIndex =3D 188 ifTrue: "Object>>withArgs:executeMethod: - CompiledMethod class>>receiver:withArguments:executeMethod: - VMMirror>>ifFail:object:with:executeMethod: et al" [| n args methodArg thisReceiver | + primitiveIndex caseOf: + {[188 "primitiveExecuteMethodArgsArray"] -> + ["Object>>withArgs:executeMethod: + CompiledMethod class>>receiver:withArguments:executeMethod: + VMMirror>>ifFail:object:with:executeMethod: et al" + ((n :=3D arguments size) between: 2 and: 4) ifFalse: + [^self class primitiveFailTokenFor: #'unsupported operation']. + ((self objectClass: (args :=3D arguments at: n - 1)) =3D=3D Array + and: [(self objectClass: (methodArg :=3D arguments at: n)) includesBe= havior: CompiledMethod]) ifFalse: + [^self class primitiveFailTokenFor: #'bad argument']. + thisReceiver :=3D arguments at: n - 2 ifAbsent: [receiver]]. + [189 "primitiveExecuteMethod"] -> + ["Object>>executeMethod: + Object>>with:...executeMethod:" + (arguments size > 0) ifFalse: + [^self class primitiveFailTokenFor: #'bad argument']. + ((self objectClass: (methodArg :=3D arguments atLast: 1)) includesBeha= vior: CompiledMethod) ifFalse: + [^self class primitiveFailTokenFor: #'bad argument']. + args :=3D arguments allButLast. + thisReceiver :=3D receiver]}. - ((n :=3D arguments size) between: 2 and: 4) ifFalse: - [^self class primitiveFailTokenFor: #'unsupported operation']. - ((self objectClass: (args :=3D arguments at: n - 1)) =3D=3D Array - and: [(self objectClass: (methodArg :=3D arguments at: n)) includesBeha= vior: CompiledMethod]) ifFalse: - [^self class primitiveFailTokenFor: #'bad argument']. methodArg numArgs =3D args size ifFalse: [^self class primitiveFailTokenFor: #'bad number of arguments']. - thisReceiver :=3D arguments at: n - 2 ifAbsent: [receiver]. methodArg primitive > 0 ifTrue: [methodArg isQuick ifTrue: [^self push: (methodArg valueWithReceiver: thisReceiver arguments: args= )]. ^self doPrimitive: methodArg primitive method: methodArg receiver: this= Receiver args: args]. ^self activateMethod: methodArg withArgs: args receiver: thisReceiver]. =20 primitiveIndex =3D 118 ifTrue: "[receiver:]tryPrimitive:withArgs:; avoid r= ecursing in the VM" [(arguments size =3D 3 and: [(self objectClass: arguments second) =3D=3D SmallInteger and: [(self objectClass: arguments last) =3D=3D Array]]) ifTrue: [^self doPrimitive: arguments second method: meth receiver: arguments fi= rst args: arguments last]. (arguments size =3D 2 and: [(self objectClass: arguments first) =3D=3D SmallInteger and: [(self objectClass: arguments last) =3D=3D Array]]) ifFalse: + [^self class primitiveFailTokenFor: -3]. - [^self class primitiveFailTokenFor: nil]. ^self doPrimitive: arguments first method: meth receiver: receiver args:= arguments last]. =20 value :=3D primitiveIndex =3D 120 "FFI method" ifTrue: [(meth literalAt: 1) tryInvokeWithArguments: arguments] ifFalse: [primitiveIndex =3D 117 "named primitives" ifTrue: [self tryNamedPrimitiveIn: meth for: receiver withArgs: argum= ents] ifFalse: "should use self receiver: receiver tryPrimitive: primitiveI= ndex withArgs: arguments but this is only in later VMs (and appears to be bro= ken)" [receiver tryPrimitive: primitiveIndex withArgs: arguments]]. =20 ^(self isPrimFailToken: value) ifTrue: [value] ifFalse: [self push: value]! Item was added: + ----- Method: Context>>executeMethod:forSelector:withArgs:receiver: (in cat= egory 'controlling') ----- + executeMethod: meth forSelector: selector withArgs: arguments receiver: rcvr +=20 + | primIndex val ctxt | + (self objectClass: meth) isCompiledCodeClass ifFalse: + ["Object as Methods (OaM) protocol: 'The contract is that, when the VM en= counters an ordinary object (rather than a compiled method) in the method dic= tionary during lookup, it sends it the special selector #run:with:in: providi= ng the original selector, arguments, and receiver.'. DOI: 10.1145/2991041.299= 1062." + ^self send: #run:with:in: + to: meth + with: {selector. arguments. rcvr}]. + =09 + meth numArgs =3D arguments size ifFalse: + [^ self class primitiveFailTokenFor: #'bad number of arguments']. + (primIndex :=3D meth primitive) > 0 ifTrue: + [val :=3D self doPrimitive: primIndex method: meth receiver: rcvr args: a= rguments. + (self isPrimFailToken: val) ifFalse: + [^val]]. + =09 + ctxt :=3D self activateMethod: meth withArgs: arguments receiver: rcvr. + (primIndex isInteger and: [primIndex > 0]) ifTrue: + [ctxt failPrimitiveWith: val]. + =09 + ^ctxt! Item was changed: ----- Method: Context>>jump:if: (in category 'instruction decoding') ----- jump: distance if: condition=20 "Simulate the action of a 'conditional jump' bytecode whose offset is the = argument, distance, and whose condition is the argument, condition." =20 | bool | bool :=3D self pop. condition =3D=3D bool ifTrue: [self jump: distance] ifFalse: [(true =3D=3D bool or: [false =3D=3D bool]) ifFalse: + [^self send: #mustBeBoolean to: bool with: #()]]! - [^self send: #mustBeBooleanIn: to: bool with: {self}]]! Item was changed: ----- Method: Context>>send:to:with:lookupIn: (in category 'controlling') -= ---- send: selector to: rcvr with: arguments lookupIn: lookupClass "Simulate the action of sending a message with selector and arguments to r= cvr. The argument, lookupClass, is the class in which to lookup the message. = This is the receiver's class for normal messages, but for super messages it w= ill be some specific class related to the source method." =20 + | meth | - | meth primIndex val ctxt | (meth :=3D lookupClass lookupSelector: selector) ifNil: [selector =3D=3D #doesNotUnderstand: ifTrue: [self error: 'Recursive message not understood!!' translated]. ^self send: #doesNotUnderstand: to: rcvr with: {(Message selector: selector arguments: arguments) lookupClass: l= ookupClass} lookupIn: lookupClass]. =09 + ^ self + executeMethod: meth + forSelector: selector + withArgs: arguments + receiver: rcvr! - (self objectClass: meth) isCompiledCodeClass ifFalse: - ["Object as Methods (OaM) protocol: 'The contract is that, when the VM en= counters an ordinary object (rather than a compiled method) in the method dic= tionary during lookup, it sends it the special selector #run:with:in: providi= ng the original selector, arguments, and receiver.'. DOI: 10.1145/2991041.299= 1062." - ^self send: #run:with:in: - to: meth - with: {selector. arguments. rcvr}]. - =09 - meth numArgs =3D arguments size ifFalse: - [^ self error: ('Wrong number of arguments in simulated message {1}' tran= slated format: {selector})]. - (primIndex :=3D meth primitive) > 0 ifTrue: - [val :=3D self doPrimitive: primIndex method: meth receiver: rcvr args: a= rguments. - (self isPrimFailToken: val) ifFalse: - [^val]]. - =09 - ctxt :=3D self activateMethod: meth withArgs: arguments receiver: rcvr. - (primIndex isInteger and: [primIndex > 0]) ifTrue: - [ctxt failPrimitiveWith: val]. - =09 - ^ctxt! Item was changed: ----- Method: Context>>stepToSendOrReturn (in category 'system simulation')= ----- stepToSendOrReturn "Simulate the execution of bytecodes until either sending a message or=20 returning a value to the receiver (that is, until switching contexts)." =20 | ctxt | [self willReallySend or: [self willReturn or: [self willReallyStore]]] whi= leFalse: [ctxt :=3D self step. ctxt =3D=3D self ifFalse: + ["Caused by mustBeBoolean handling or callPrimitive:" + ^ctxt stepToSendOrReturn]]! - [self halt.=20 - "Caused by mustBeBoolean handling" - ^ctxt]]! Item was added: + ----- Method: False>>mustBeBooleanIn: (in category 'converting') ----- + mustBeBooleanIn: aContext + "Overwritten to support conditional jumps (ifTrue:/ifFalse:) based on a pr= oxy to true/false. The jump will first fail, send #mustBeBoolean to the proxy= , which will forward hither. Here, we correct the context by replacing the pr= oxy on the stack through the canonical instance of ourselves and reattempting= the jump. See ObjectTracer>>mustBeBoolean for an example." +=20 + aContext skipBackBeforeJump. + ^ false! Item was changed: ----- Method: Object>>withArgs:executeMethod: (in category 'message handlin= g') ----- withArgs: argArray executeMethod: compiledMethod "Execute compiledMethod against the receiver and args in argArray" =20 + | context | - | selector | + context :=3D thisContext + executeMethod: compiledMethod + forSelector: Symbol new + withArgs: argArray + receiver: self. + ^ context =3D=3D thisContext + ifTrue: ["quick return" thisContext top] + ifFalse: [context jump]! - selector :=3D Symbol new. - self class addSelectorSilently: selector withMethod: compiledMethod. - ^ [self perform: selector withArguments: argArray] - ensure: [self class basicRemoveSelector: selector]! Item was added: + ----- Method: ObjectTracer>>mustBeBoolean (in category 'very few messages')= ----- + mustBeBoolean + "Overwritten to preserve original sender context. + =09 + This is required to support conditional jumps (ifTrue:/ifFalse:) based on = traced booleans, e.g.: + (ObjectTracer on: false) ifTrue: [1] ifFalse: [2]." +=20 + ^ self mustBeBooleanIn: thisContext sender! Item was added: + ----- Method: True>>mustBeBooleanIn: (in category 'converting') ----- + mustBeBooleanIn: aContext + "Overwritten to support conditional jumps (ifTrue:/ifFalse:) based on a pr= oxy to true/false. The jump will first fail, send #mustBeBoolean to the proxy= , which will forward hither. Here, we correct the context by replacing the pr= oxy on the stack through the canonical instance of ourselves and reattempting= the jump. See ObjectTracer>>mustBeBoolean for an example." +=20 + aContext skipBackBeforeJump. + ^ true! --===============1180474948183008703==-- From commits@source.squeak.org Sun Feb 25 19:32:27 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1420.mcz Date: Sun, 25 Feb 2024 19:32:13 +0000 Message-ID: <20240225193225.F06EE584086@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8482672358703954791==" --===============8482672358703954791== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1420.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1420 Author: ct Time: 10 November 2021, 1:47:10.350242 am UUID: 8f2e7a27-2c7b-534a-9c78-a90c968e45c5 Ancestors: Kernel-eem.1418 Aligns the error code for primitive 118 during simulation with what the VM re= turns. See KernelTests-ct.409/#testPrimitive118/{6. 'not a primitive'. {7}},{= 6. 9. 'not an array'}. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-eem.1418 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: Context>>doPrimitive:method:receiver:args: (in category 'priv= ate') ----- doPrimitive: primitiveIndex method: meth receiver: receiver args: arguments "Simulate a primitive method whose index is primitiveIndex. The simulated= receiver and arguments are given as arguments to this message. If successful, push res= ult and return resuming context, else ^ {errCode, PrimitiveFailToken}. Any primitive whi= ch provokes execution needs to be intercepted and simulated to avoid execution runnin= g away." =20 | value | "Judicious use of primitive 19 (a null primitive that doesn't do anything)= prevents the debugger from entering various run-away activities such as spawning a= new process, etc. Injudicious use results in the debugger not being able to = debug interesting code, such as the debugger itself. Hence use primitive 19 wi= th care :-)" "SystemNavigation new browseAllSelect: [:m| m primitive =3D 19]" primitiveIndex =3D 19 ifTrue: [ [self notify: ('The code being simulated is trying to control a process (= {1}). Process controlling cannot be simulated. If you proceed, things may hap= pen outside the observable area of the simulator.' translated format: {meth r= eference})] ifCurtailed: [self push: nil "Cheap fix of the context's internal state"= ]]. =09 ((primitiveIndex between: 201 and: 222) and: [(self objectClass: receiver) includesBehavior: BlockClosure]) ifTru= e: [(primitiveIndex =3D 206 or: [primitiveIndex =3D 208]) ifTrue: "[Full]BlockClosure>>valueWi= thArguments:" [^receiver simulateValueWithArguments: arguments first caller: self]. ((primitiveIndex between: 201 and: 209) "[Full]BlockClosure>>value[:v= alue:...]" or: [primitiveIndex between: 221 and: 222]) ifTrue: "[Full]BlockClosure= >>valueNoContextSwitch[:]" [^receiver simulateValueWithArguments: arguments caller: self]]. =20 primitiveIndex =3D 83 ifTrue: "afr 9/11/1998 19:50" "Object>>perform:[with= :...]" [| selector | selector :=3D arguments at: 1 ifAbsent: [^ self class primitiveFailTokenFor: #'bad argument']. arguments size - 1 =3D selector numArgs ifFalse: [^ self class primitiveFailTokenFor: #'bad number of arguments']. ^self send: selector to: receiver with: arguments allButFirst]. primitiveIndex =3D 84 ifTrue: "afr 9/11/1998 19:50 & eem 8/18/2009 17:04" = "Object>>perform:withArguments:" [| selector args | arguments size =3D 2 ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. selector :=3D arguments first. args :=3D arguments second. args isArray ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. args size =3D selector numArgs ifFalse: [^ self class primitiveFailTokenFor: #'bad number of arguments']. ^self send: selector to: receiver with: args]. primitiveIndex =3D 100 ifTrue: "eem 8/18/2009 16:57" "Object>>perform:with= Arguments:inSuperclass:" [| rcvr selector args superclass | arguments size caseOf: { [3] -> [ rcvr :=3D receiver. selector :=3D arguments first. args :=3D arguments second. superclass :=3D arguments third]. [4] -> ["mirror primitive" rcvr :=3D arguments first. selector :=3D arguments second. args :=3D arguments third. superclass :=3D arguments fourth] } otherwise: [^ self class primitiveFailTokenFor: #'bad argument']. args isArray ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. args size =3D selector numArgs ifFalse: [^ self class primitiveFailTokenFor: #'bad number of arguments']. ((self objectClass: rcvr) includesBehavior: superclass) ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. ^self send: selector to: rcvr with: args lookupIn: superclass]. =20 "Mutex>>primitiveEnterCriticalSection Mutex>>primitiveTestAndSetOwnershipOfCriticalSection" (primitiveIndex =3D 186 or: [primitiveIndex =3D 187]) ifTrue: [| effective | effective :=3D Processor activeProcess effectiveProcess. "active =3D=3D effective" value :=3D primitiveIndex =3D 186 ifTrue: [receiver primitiveEnterCriticalSectionOnBehalfOf: effective] ifFalse: [receiver primitiveTestAndSetOwnershipOfCriticalSectionOnBeha= lfOf: effective]. ^(self isPrimFailToken: value) ifTrue: [value] ifFalse: [self push: value]]. =20 primitiveIndex =3D 188 ifTrue: "Object>>withArgs:executeMethod: CompiledMethod class>>receiver:withArguments:executeMethod: VMMirror>>ifFail:object:with:executeMethod: et al" [| n args methodArg thisReceiver | ((n :=3D arguments size) between: 2 and: 4) ifFalse: [^self class primitiveFailTokenFor: #'unsupported operation']. ((self objectClass: (args :=3D arguments at: n - 1)) =3D=3D Array and: [(self objectClass: (methodArg :=3D arguments at: n)) includesBeha= vior: CompiledMethod]) ifFalse: [^self class primitiveFailTokenFor: #'bad argument']. methodArg numArgs =3D args size ifFalse: [^self class primitiveFailTokenFor: #'bad number of arguments']. thisReceiver :=3D arguments at: n - 2 ifAbsent: [receiver]. methodArg primitive > 0 ifTrue: [methodArg isQuick ifTrue: [^self push: (methodArg valueWithReceiver: thisReceiver arguments: args= )]. ^self doPrimitive: methodArg primitive method: meth receiver: thisRecei= ver args: args]. ^Context sender: self receiver: thisReceiver method: methodArg arguments: args]. =20 primitiveIndex =3D 118 ifTrue: "[receiver:]tryPrimitive:withArgs:; avoid r= ecursing in the VM" [(arguments size =3D 3 and: [(self objectClass: arguments second) =3D=3D SmallInteger and: [(self objectClass: arguments last) =3D=3D Array]]) ifTrue: [^self doPrimitive: arguments second method: meth receiver: arguments fi= rst args: arguments last]. (arguments size =3D 2 and: [(self objectClass: arguments first) =3D=3D SmallInteger and: [(self objectClass: arguments last) =3D=3D Array]]) ifFalse: + [^self class primitiveFailTokenFor: -3]. - [^self class primitiveFailTokenFor: nil]. ^self doPrimitive: arguments first method: meth receiver: receiver args:= arguments last]. =20 value :=3D primitiveIndex =3D 120 "FFI method" ifTrue: [(meth literalAt: 1) tryInvokeWithArguments: arguments] ifFalse: [primitiveIndex =3D 117 "named primitives" ifTrue: [self tryNamedPrimitiveIn: meth for: receiver withArgs: argum= ents] ifFalse: "should use self receiver: receiver tryPrimitive: primitiveI= ndex withArgs: arguments but this is only in later VMs (and appears to be bro= ken)" [receiver tryPrimitive: primitiveIndex withArgs: arguments]]. =20 ^(self isPrimFailToken: value) ifTrue: [value] ifFalse: [self push: value]! --===============8482672358703954791==-- From commits@source.squeak.org Sun Feb 25 19:38:52 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1451.mcz Date: Sun, 25 Feb 2024 19:38:33 +0000 Message-ID: <20240225193849.5C92C584086@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8513329042045761494==" --===============8513329042045761494== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1451.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1451 Author: ct Time: 25 March 2022, 6:47:25.617514 pm UUID: 94732d1b-58e4-9f4b-a1b3-c950af711c77 Ancestors: Kernel-nice.1447 Revises fallback code for primitive 188 (primitiveExecuteMethodArgsArray) in = Object>>#withArgs:executeMethod: and eliminates any side-effects to the metho= d dictionary. This also adds support for Objects as Methods (OaM) in this pla= ce. To achieve this, extract and reuse the simulation of method execution fro= m Context>>#send:to:with:lookupIn:. Thanks to Eliot for the idea! This is the next iteration of Kernel-ct.1449 (i= nbox). The second part of that version (arity checks in sim of primitivePerfo= rm[WithArgs]) still remains relevant, though. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-nice.1447 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: Context>>executeMethod:forSelector:withArgs:receiver: (in cat= egory 'controlling') ----- + executeMethod: meth forSelector: selector withArgs: arguments receiver: rcvr +=20 + | primIndex val ctxt | + (self objectClass: meth) isCompiledCodeClass ifFalse: + ["Object as Methods (OaM) protocol: 'The contract is that, when the VM en= counters an ordinary object (rather than a compiled method) in the method dic= tionary during lookup, it sends it the special selector #run:with:in: providi= ng the original selector, arguments, and receiver.'. DOI: 10.1145/2991041.299= 1062." + ^self send: #run:with:in: + to: meth + with: {selector. arguments. rcvr}]. + =09 + meth numArgs =3D arguments size ifFalse: + [^ self error: ('Wrong number of arguments in simulated method {1}' trans= lated format: {meth})]. + (primIndex :=3D meth primitive) > 0 ifTrue: + [val :=3D self doPrimitive: primIndex method: meth receiver: rcvr args: a= rguments. + (self isPrimFailToken: val) ifFalse: + [^val]]. + =09 + ctxt :=3D self activateMethod: meth withArgs: arguments receiver: rcvr. + (primIndex isInteger and: [primIndex > 0]) ifTrue: + [ctxt failPrimitiveWith: val]. + =09 + ^ctxt! Item was changed: ----- Method: Context>>send:to:with:lookupIn: (in category 'controlling') -= ---- send: selector to: rcvr with: arguments lookupIn: lookupClass "Simulate the action of sending a message with selector and arguments to r= cvr. The argument, lookupClass, is the class in which to lookup the message. = This is the receiver's class for normal messages, but for super messages it w= ill be some specific class related to the source method." =20 + | meth | - | meth primIndex val ctxt | (meth :=3D lookupClass lookupSelector: selector) ifNil: [selector =3D=3D #doesNotUnderstand: ifTrue: [self error: 'Recursive message not understood!!' translated]. ^self send: #doesNotUnderstand: to: rcvr with: {(Message selector: selector arguments: arguments) lookupClass: l= ookupClass} lookupIn: lookupClass]. =09 + ^ self + executeMethod: meth + forSelector: selector + withArgs: arguments + receiver: rcvr! - (self objectClass: meth) isCompiledCodeClass ifFalse: - ["Object as Methods (OaM) protocol: 'The contract is that, when the VM en= counters an ordinary object (rather than a compiled method) in the method dic= tionary during lookup, it sends it the special selector #run:with:in: providi= ng the original selector, arguments, and receiver.'. DOI: 10.1145/2991041.299= 1062." - ^self send: #run:with:in: - to: meth - with: {selector. arguments. rcvr}]. - =09 - meth numArgs =3D arguments size ifFalse: - [^ self error: ('Wrong number of arguments in simulated message {1}' tran= slated format: {selector})]. - (primIndex :=3D meth primitive) > 0 ifTrue: - [val :=3D self doPrimitive: primIndex method: meth receiver: rcvr args: a= rguments. - (self isPrimFailToken: val) ifFalse: - [^val]]. - =09 - ctxt :=3D self activateMethod: meth withArgs: arguments receiver: rcvr. - (primIndex isInteger and: [primIndex > 0]) ifTrue: - [ctxt failPrimitiveWith: val]. - =09 - ^ctxt! Item was changed: ----- Method: Object>>withArgs:executeMethod: (in category 'message handlin= g') ----- withArgs: argArray executeMethod: compiledMethod "Execute compiledMethod against the receiver and args in argArray" =20 + | context | - | selector | + context :=3D thisContext + executeMethod: compiledMethod + forSelector: Symbol new + withArgs: argArray + receiver: self. + ^ context =3D=3D thisContext + ifTrue: ["quick return" thisContext top] + ifFalse: [context jump]! - selector :=3D Symbol new. - self class addSelectorSilently: selector withMethod: compiledMethod. - ^ [self perform: selector withArguments: argArray] - ensure: [self class basicRemoveSelector: selector]! --===============8513329042045761494==-- From commits@source.squeak.org Sun Feb 25 19:43:39 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1449.mcz Date: Sun, 25 Feb 2024 19:43:23 +0000 Message-ID: <20240225194336.D86775840A3@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8109175937856284174==" --===============8109175937856284174== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1449.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1449 Author: ct Time: 12 March 2022, 1:51:11.452359 am UUID: 75c8b415-7b05-854e-a772-0412e6a1fd60 Ancestors: Kernel-ct.1448 Fixes handling of objects as methods in Object>>#withArgs:executeMethods:. Co= mplements KernelTests-ct.421. There were actually two issues: 1. The fallback code in Object>>#withArgs:executeMethod: had multiple unexpec= ted side effects because Behavior>>#basicAddSelector:withMethod: would modify= the state (selector+methodClass) of the compiledMethod. If compiledMethod wa= s not a valid CompiledMethod or object as method and did not understand #meth= odClass: and #selector: correctly, the #addSelectorSilently:withMethod: would= have failed non-atomatically and left the method dictionary of the receiver = class with a dangling auxiliary symbol key that would never be cleaned up. 2. primitive 83 (primitivePerform) and primitive 84 (primitivePerformWithArgs= ) must not check the arity of the selector but only the arity of the resolved= method if that is not an object as method. This patch aligns the simulation = of these primitives to the VM behavior so that the fallback code in Object>>#= withArgs:executeMethod: also works in the simulator. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-nice.1447 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: Context>>doPrimitive:method:receiver:args: (in category 'priv= ate') ----- doPrimitive: primitiveIndex method: meth receiver: receiver args: arguments "Simulate a primitive method whose index is primitiveIndex. The simulated= receiver and arguments are given as arguments to this message. If successful, push res= ult and return resuming context, else ^ {errCode, PrimitiveFailToken}. Any primitive whi= ch provokes execution needs to be intercepted and simulated to avoid execution runnin= g away." =20 | value | "Judicious use of primitive 19 (a null primitive that doesn't do anything)= prevents the debugger from entering various run-away activities such as spawning a= new process, etc. Injudicious use results in the debugger not being able to = debug interesting code, such as the debugger itself. Hence use primitive 19 wi= th care :-)" "SystemNavigation new browseAllSelect: [:m| m primitive =3D 19]" primitiveIndex =3D 19 ifTrue: [ [self notify: ('The code being simulated is trying to control a process (= {1}). Process controlling cannot be simulated. If you proceed, things may hap= pen outside the observable area of the simulator.' translated format: {meth r= eference})] ifCurtailed: [self push: nil "Cheap fix of the context's internal state"= ]]. =09 ((primitiveIndex between: 201 and: 222) and: [(self objectClass: receiver) includesBehavior: BlockClosure]) ifTru= e: [(primitiveIndex =3D 206 or: [primitiveIndex =3D 208]) ifTrue: "[Full]BlockClosure>>valueWi= thArguments:" [^receiver simulateValueWithArguments: arguments first caller: self]. ((primitiveIndex between: 201 and: 209) "[Full]BlockClosure>>value[:v= alue:...]" or: [primitiveIndex between: 221 and: 222]) ifTrue: "[Full]BlockClosure= >>valueNoContextSwitch[:]" [^receiver simulateValueWithArguments: arguments caller: self]]. =20 primitiveIndex =3D 83 ifTrue: "afr 9/11/1998 19:50" "Object>>perform:[with= :...]" [| selector | selector :=3D arguments at: 1 ifAbsent: [^ self class primitiveFailTokenFor: #'bad argument']. + ((self objectClass: receiver) lookupSelector: selector) ifNotNil: [:metho= dArg | + ((self objectClass: methodArg) isCompiledCodeClass and: [arguments size = - 1 ~=3D methodArg numArgs]) + ifTrue: [^ self class primitiveFailTokenFor: #'bad number of arguments'= ]]. - arguments size - 1 =3D selector numArgs ifFalse: - [^ self class primitiveFailTokenFor: #'bad number of arguments']. ^self send: selector to: receiver with: arguments allButFirst]. primitiveIndex =3D 84 ifTrue: "afr 9/11/1998 19:50 & eem 8/18/2009 17:04" = "Object>>perform:withArguments:" [| selector args | arguments size =3D 2 ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. selector :=3D arguments first. args :=3D arguments second. args isArray ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. + ((self objectClass: receiver) lookupSelector: selector) ifNotNil: [:metho= dArg | + ((self objectClass: methodArg) isCompiledCodeClass and: [args size ~=3D = methodArg numArgs]) + ifTrue: [^ self class primitiveFailTokenFor: #'bad number of arguments'= ]]. - args size =3D selector numArgs ifFalse: - [^ self class primitiveFailTokenFor: #'bad number of arguments']. ^self send: selector to: receiver with: args]. primitiveIndex =3D 100 ifTrue: "eem 8/18/2009 16:57" "Object>>perform:with= Arguments:inSuperclass:" [| rcvr selector args superclass | arguments size caseOf: { [3] -> [ rcvr :=3D receiver. selector :=3D arguments first. args :=3D arguments second. superclass :=3D arguments third]. [4] -> ["mirror primitive" rcvr :=3D arguments first. selector :=3D arguments second. args :=3D arguments third. superclass :=3D arguments fourth] } otherwise: [^ self class primitiveFailTokenFor: #'bad argument']. args isArray ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. args size =3D selector numArgs ifFalse: [^ self class primitiveFailTokenFor: #'bad number of arguments']. ((self objectClass: rcvr) includesBehavior: superclass) ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. ^self send: selector to: rcvr with: args lookupIn: superclass]. =20 "Mutex>>primitiveEnterCriticalSection Mutex>>primitiveTestAndSetOwnershipOfCriticalSection" (primitiveIndex =3D 186 or: [primitiveIndex =3D 187]) ifTrue: [| effective | effective :=3D Processor activeProcess effectiveProcess. "active =3D=3D effective" value :=3D primitiveIndex =3D 186 ifTrue: [receiver primitiveEnterCriticalSectionOnBehalfOf: effective] ifFalse: [receiver primitiveTestAndSetOwnershipOfCriticalSectionOnBeha= lfOf: effective]. ^(self isPrimFailToken: value) ifTrue: [value] ifFalse: [self push: value]]. + =09 + (primitiveIndex =3D 188 or: [primitiveIndex =3D 189]) ifTrue: -=20 - primitiveIndex =3D 188 ifTrue: "Object>>withArgs:executeMethod: - CompiledMethod class>>receiver:withArguments:executeMethod: - VMMirror>>ifFail:object:with:executeMethod: et al" [| n args methodArg thisReceiver | + primitiveIndex caseOf: + {[188 "primitiveExecuteMethodArgsArray"] -> + ["Object>>withArgs:executeMethod: + CompiledMethod class>>receiver:withArguments:executeMethod: + VMMirror>>ifFail:object:with:executeMethod: et al" + ((n :=3D arguments size) between: 2 and: 4) ifFalse: + [^self class primitiveFailTokenFor: #'unsupported operation']. + ((self objectClass: (args :=3D arguments at: n - 1)) =3D=3D Array + and: [(self objectClass: (methodArg :=3D arguments at: n)) includesBe= havior: CompiledMethod]) ifFalse: + [^self class primitiveFailTokenFor: #'bad argument']. + thisReceiver :=3D arguments at: n - 2 ifAbsent: [receiver]]. + [189 "primitiveExecuteMethod"] -> + ["Object>>executeMethod: + Object>>with:...executeMethod:" + (arguments size > 0) ifFalse: + [^self class primitiveFailTokenFor: #'bad argument']. + ((self objectClass: (methodArg :=3D arguments atLast: 1)) includesBeha= vior: CompiledMethod) ifFalse: + [^self class primitiveFailTokenFor: #'bad argument']. + args :=3D arguments allButLast. + thisReceiver :=3D receiver]}. - ((n :=3D arguments size) between: 2 and: 4) ifFalse: - [^self class primitiveFailTokenFor: #'unsupported operation']. - ((self objectClass: (args :=3D arguments at: n - 1)) =3D=3D Array - and: [(self objectClass: (methodArg :=3D arguments at: n)) includesBeha= vior: CompiledMethod]) ifFalse: - [^self class primitiveFailTokenFor: #'bad argument']. methodArg numArgs =3D args size ifFalse: [^self class primitiveFailTokenFor: #'bad number of arguments']. - thisReceiver :=3D arguments at: n - 2 ifAbsent: [receiver]. methodArg primitive > 0 ifTrue: [methodArg isQuick ifTrue: [^self push: (methodArg valueWithReceiver: thisReceiver arguments: args= )]. ^self doPrimitive: methodArg primitive method: meth receiver: thisRecei= ver args: args]. ^self activateMethod: methodArg withArgs: args receiver: thisReceiver]. =20 primitiveIndex =3D 118 ifTrue: "[receiver:]tryPrimitive:withArgs:; avoid r= ecursing in the VM" [(arguments size =3D 3 and: [(self objectClass: arguments second) =3D=3D SmallInteger and: [(self objectClass: arguments last) =3D=3D Array]]) ifTrue: [^self doPrimitive: arguments second method: meth receiver: arguments fi= rst args: arguments last]. (arguments size =3D 2 and: [(self objectClass: arguments first) =3D=3D SmallInteger and: [(self objectClass: arguments last) =3D=3D Array]]) ifFalse: [^self class primitiveFailTokenFor: nil]. ^self doPrimitive: arguments first method: meth receiver: receiver args:= arguments last]. =20 value :=3D primitiveIndex =3D 120 "FFI method" ifTrue: [(meth literalAt: 1) tryInvokeWithArguments: arguments] ifFalse: [primitiveIndex =3D 117 "named primitives" ifTrue: [self tryNamedPrimitiveIn: meth for: receiver withArgs: argum= ents] ifFalse: "should use self receiver: receiver tryPrimitive: primitiveI= ndex withArgs: arguments but this is only in later VMs (and appears to be bro= ken)" [receiver tryPrimitive: primitiveIndex withArgs: arguments]]. =20 ^(self isPrimFailToken: value) ifTrue: [value] ifFalse: [self push: value]! Item was changed: ----- Method: Object>>withArgs:executeMethod: (in category 'message handlin= g') ----- withArgs: argArray executeMethod: compiledMethod "Execute compiledMethod against the receiver and args in argArray" =20 | selector | selector :=3D Symbol new. + self class methodDict at: selector put: compiledMethod. + ^ [self perform: selector flushCache withArguments: argArray] - self class addSelectorSilently: selector withMethod: compiledMethod. - ^ [self perform: selector withArguments: argArray] ensure: [self class basicRemoveSelector: selector]! --===============8109175937856284174==-- From commits@source.squeak.org Sun Feb 25 19:47:06 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: KernelTests-ct.453.mcz Date: Sun, 25 Feb 2024 19:46:52 +0000 Message-ID: <20240225194704.18E775840AA@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7928377171753992527==" --===============7928377171753992527== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of KernelTests to project The Trunk: http://source.squeak.org/trunk/KernelTests-ct.453.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: KernelTests-ct.453 Author: ct Time: 25 February 2024, 8:46:33.380593 pm UUID: 081d7c84-95a3-3848-b6e6-a4a7c5007915 Ancestors: KernelTests-ct.452, KernelTests-ct.409, KernelTests-ct.417, Kernel= Tests-ct.421, KernelTests-ct.448 Merges and revises several simulation tests from the inbox. As always, please= refer to the original versions to read their full messages. KernelTests-ct.376: Tests #contextEnsure: and #contextOn:do:. Includes regression tests for Kern= el-ct.1296. =09 Revision: Reduced overdetailed commentary and overcautious exception handler= s, now that simulation works more robust. KernelTests-ct.409: Adds new simulation tests for the reflection primitives 117 (primitiveExtern= alCall), 118 (primitiveDoPrimitiveWithArgs), and 218 (primitiveDoNamedPrimiti= veWithArgs) and revises existing tests for the primitives 83 (primitivePerfor= m), 84 (primitivePerformWithArgs), and 100 (primitivePerformInSuperclass) whi= ch do not need to be dispatched via primitive 118. =09 Revision: Completely rework previously useless testPrimitive117. Revise exam= ples in testPrimitive118: and testPrimitive218. Extend testPrimitive83 and te= stPrimitive84 with examples for invalid selectors and Objects as Methods and = make the assertion more debug-friendly. Improve commentary. Document known fa= ilures due to erroneous VM behavior. Recategorize. KernelTests-ct.417: Acceptance tests for #runUntilErrorOrReturnFrom:. =09 Revision: Test resumed simulation of context after error. KernelTests-ct.420: Tests simulation of primitive 188 (primitiveExecuteMethodArgsArray) and prim= itive 189 (primitiveExecuteMethod). =09 Revision: Add example for invalid method to testPrimitive188:. Make assertio= ns more debug-friendly. Improve commentary. KernelTests-ct.421: Tests handling of objects as methods (OaM) during simulation of Object>>#wit= hArgs:executeMethod: and Object>>#with:...executeMethod:. KernelTests-ct.448: Complements Kernel-ct.1546 (fixes stepping through #mustBeBoolean errors and= restarting from primitive methods that no longer fail). =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against KernelTests-ct.452= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: ContextTest>>simulate: (in category 'private') ----- + simulate: aBlock +=20 + | result | + [result :=3D aBlock value] newProcess runUntil: [:ctxt | false]. + ^ result! Item was changed: + ----- Method: ContextTest>>testBlockCannotReturn (in category 'tests - simu= lation') ----- - ----- Method: ContextTest>>testBlockCannotReturn (in category 'tests') ----- testBlockCannotReturn "Test if #return:from: correctly handles returns to dead or nil contexts." =20 | p | p :=3D [ thisContext pc: nil ] newProcess. p runUntil: [:ctx | ctx method selector =3D #pc: and: [ctx sender isDead]]. =09 "assert p stoped at the last instruction, i.e. a return, of #pc: and is about to return to a dead context" self assert: p suspendedContext method selector equals: #pc:. self assert: p suspendedContext sender isDead. self assert: p suspendedContext willReturn. self assert: p suspendedContext atEnd. =09 p step. "step into a return to a dead sender" =20 self assert: p suspendedContext method selector =3D #cannotReturn:! Item was changed: + ----- Method: ContextTest>>testBlockCannotReturnToNil (in category 'tests -= simulation') ----- - ----- Method: ContextTest>>testBlockCannotReturnToNil (in category 'tests')= ----- testBlockCannotReturnToNil "Test if #return:from: correctly handles returns to dead or nil contexts." =20 | context nextContext | context :=3D [] asContext. =09 "assert p is at the last instruction, i.e. a return, and is about to retur= n to a nil context" self assert: context method selector =3D thisContext method selector. self assert: context sender isNil. self assert: context willReturn. self assert: context atEnd. =09 nextContext :=3D context step. "step into a return to a nil sender" =20 self assert: nextContext method selector =3D #cannotReturn:! Item was added: + ----- Method: ContextTest>>testContextEnsure (in category 'tests') ----- + testContextEnsure +=20 + | sideEffect block result | + block :=3D + [sideEffect :=3D nil. + thisContext insertSender: + (Context contextEnsure: + [sideEffect :=3D sideEffect + 1]). + sideEffect :=3D 0]. + =09 + result :=3D block value. + =09 + self assert: 0 equals: result. + self assert: 1 equals: sideEffect.! Item was added: + ----- Method: ContextTest>>testContextEnsureSimulation (in category 'tests'= ) ----- + testContextEnsureSimulation + "Regression test for http://forum.world.st/BUG-s-in-Context-control-jump-r= unUntilErrorOrReturnFrom-td5107263.html" +=20 + | sideEffect block result | + block :=3D + [sideEffect :=3D nil. + thisContext insertSender: + (Context contextEnsure: + [sideEffect :=3D sideEffect + 1]). + sideEffect :=3D 0]. + =09 + result :=3D self simulate: block. + =09 + self assert: 0 equals: result. + self assert: 1 equals: sideEffect.! Item was added: + ----- Method: ContextTest>>testContextEnsureSimulationWithError (in categor= y 'tests') ----- + testContextEnsureSimulationWithError + "Regression test for http://forum.world.st/BUG-s-in-Context-control-jump-r= unUntilErrorOrReturnFrom-td5107263.html" +=20 + | sideEffect block result | + block :=3D + [sideEffect :=3D nil. + thisContext insertSender: + (Context contextEnsure: + [sideEffect :=3D sideEffect + 1]). + sideEffect :=3D 0. + self error]. + =09 + result :=3D self simulate: [[block value] on: Error do: [42]]. + =09 + self assert: 42 equals: result. + self assert: 1 equals: sideEffect.! Item was added: + ----- Method: ContextTest>>testContextEnsureWithError (in category 'tests')= ----- + testContextEnsureWithError +=20 + | sideEffect block result | + block :=3D + [sideEffect :=3D nil. + thisContext insertSender: + (Context contextEnsure: + [sideEffect :=3D sideEffect + 1]). + sideEffect :=3D 0. + self error]. + =09 + result :=3D [block value] on: Error do: [42]. + =09 + self assert: 42 equals: result. + self assert: 1 equals: sideEffect.! Item was added: + ----- Method: ContextTest>>testContextOnDo (in category 'tests') ----- + testContextOnDo +=20 + | sideEffect block result | + block :=3D + [sideEffect :=3D nil. + thisContext insertSender: + (Context contextOn: Error do: + [sideEffect :=3D sideEffect + 1]). + sideEffect :=3D 0]. + =09 + result :=3D block value. + =09 + self assert: 0 equals: result. + self assert: 0 equals: sideEffect.! Item was added: + ----- Method: ContextTest>>testContextOnDoSimulation (in category 'tests') = ----- + testContextOnDoSimulation + "Regression test for http://forum.world.st/BUG-s-in-Context-control-jump-r= unUntilErrorOrReturnFrom-td5107263.html" +=20 + | sideEffect block result | + block :=3D + [sideEffect :=3D nil. + thisContext insertSender: + (Context contextOn: Error do: + [sideEffect :=3D sideEffect + 1]). + sideEffect :=3D 0]. + =09 + result :=3D self simulate: block. + =09 + self assert: 0 equals: result. + self assert: 0 equals: sideEffect.! Item was added: + ----- Method: ContextTest>>testContextOnDoSimulationWithError (in category = 'tests') ----- + testContextOnDoSimulationWithError + "Regression test for http://forum.world.st/BUG-s-in-Context-control-jump-r= unUntilErrorOrReturnFrom-td5107263.html" +=20 + | sideEffect block result | + block :=3D + [sideEffect :=3D nil. + thisContext insertSender: + (Context contextOn: Error do: + [sideEffect :=3D sideEffect + 1. + 42]). + sideEffect :=3D 0. + self error]. + =09 + result :=3D self simulate: block. + =09 + self assert: 42 equals: result. + self assert: 1 equals: sideEffect.! Item was added: + ----- Method: ContextTest>>testContextOnDoWithError (in category 'tests') -= ---- + testContextOnDoWithError +=20 + | sideEffect block result | + block :=3D + [sideEffect :=3D nil. + thisContext insertSender: + (Context contextOn: Error do: + [sideEffect :=3D sideEffect + 1. + 42]). + sideEffect :=3D 0. + self error]. + =09 + result :=3D block value. + =09 + self assert: 42 equals: result. + self assert: 1 equals: sideEffect.! Item was changed: + ----- Method: ContextTest>>testCopyStack (in category 'tests - query') ----- - ----- Method: ContextTest>>testCopyStack (in category 'tests') ----- testCopyStack self assert: aContext copyStack printString =3D aContext printString.! Item was changed: + ----- Method: ContextTest>>testCopyTo (in category 'tests - query') ----- - ----- Method: ContextTest>>testCopyTo (in category 'tests') ----- testCopyTo =20 | context depth targetSender | context :=3D thisContext. depth :=3D 1. targetSender :=3D context. [ (targetSender :=3D targetSender sender) isNil ] whileFalse: [ | original copy | original :=3D context. copy :=3D context copyTo: targetSender. 1 to: depth do: [ :index | index =3D 1 ifFalse: [=20 "Since we're copying thisContext, the pc and stackPtr may be different = for the current frame." self assert: original pc equals: copy pc; assert: original stackPtr equals: copy stackPtr ]. self deny: original =3D=3D copy; assert: original method equals: copy method; assert: original closure equals: copy closure; assert: original receiver equals: copy receiver. original :=3D original sender. copy :=3D copy sender ]. self assert: copy isNil; assert: original =3D=3D targetSender. depth :=3D depth + 1 ]! Item was changed: + ----- Method: ContextTest>>testFindContextSuchThat (in category 'tests - qu= ery') ----- - ----- Method: ContextTest>>testFindContextSuchThat (in category 'tests') --= --- testFindContextSuchThat self assert: (aContext findContextSuchThat: [:each| true]) printString =3D= aContext printString. self assert: (aContext hasContext: aContext). ! Item was changed: + ----- Method: ContextTest>>testMessageNotUnderstood (in category 'tests - s= imulation') ----- - ----- Method: ContextTest>>testMessageNotUnderstood (in category 'tests') -= ---- testMessageNotUnderstood =20 "A simulation error (recursive message not understood) occurs that cannot = be handled by the simulated code" self should: [Context runSimulated: [[TestEmptyClass new foo] on: Error do: [:ex | ex]]] raise: Error. =09 "The simulator sends #doesNotUnderstand: to the receiver even if the looku= p class has no superclass." self assert: [Context runSimulated: [self executeShould: [ProtoObject new foo] inScopeOf: MessageNotUnderstood]]. self assert: [Context runSimulated: [self executeShould: [Compiler evaluate: 'super foo' for: Object new] inScopeOf: MessageNotUnderstood]].! Item was changed: + ----- Method: ContextTest>>testObjectsAsMethod (in category 'tests - simula= tion') ----- - ----- Method: ContextTest>>testObjectsAsMethod (in category 'tests') ----- testObjectsAsMethod =20 | result error | + [SystemChangeNotifier uniqueInstance doSilently: [ - SystemChangeNotifier uniqueInstance doSilently: [ self class addSelector: #foo withMethod: (TestObjectForMethod new xxxMeth= od: thisContext homeMethod)]. =09 result :=3D Context runSimulated: [[self foo] on: Error do: [:ex | error := =3D ex]]. + error ifNotNil: [self fail: error]] - error ifNotNil: [self fail: error]. =09 + ensure: + [SystemChangeNotifier uniqueInstance doSilently: [ + [self assert: self foo equals: result] + ensure: [self class removeSelector: #foo]]].! - SystemChangeNotifier uniqueInstance doSilently: [ - [self assert: self foo equals: result] - ensure: [self class removeSelector: #foo]].! Item was changed: + ----- Method: ContextTest>>testPrimitive100 (in category 'tests - simulatio= n') ----- - ----- Method: ContextTest>>testPrimitive100 (in category 'tests') ----- testPrimitive100 + "Test simulation of primitive 100." =20 { {#isNil. {}. Object}. "valid 0-arg message" {#=3D. {true}. UndefinedObject}. "valid unary message" {#ifNil:ifNotNil:. {[2]. [:x | x]}. Object}. "valid binary message" {{}. #=3D. {true}. SequenceableCollection}. "mirror primitive" + {'not a selector'. {}. Object}. "invalid selector" + {#isNil. 'not an array'. Object}. "invalid arguments" - {#isNil}. "missing arguments" - {#isNil. 'not an array'}. "invalid arguments" - {#isNil. {}}. "missing lookupClass" {#isNil. {'excess arg'}. Object}. "too many arguments" {#=3D. {}. UndefinedObject}. "missing argument" + {#isNil. {}. 'not a class'}. "invalid lookupClass" {#isNil. {}. Boolean}. "lookupClass not in inheritance chain" + } do: [:args | | block | + block :=3D [[nil + perform: args first + withArguments: args second + inSuperclass: args third] + on: Error do: [:ex | ex description]]. - } do: [:args | self + assert: block value + equals: (Context runSimulated: block). + =09 + block :=3D [[thisContext + object: nil + perform: args first + withArguments: args second + inClass: args third] + on: Error do: [:ex | ex description]]. + self + assert: block value + equals: (Context runSimulated: block)].! - assert: (nil tryPrimitive: 100 withArgs: args) - equals: (Context runSimulated: [nil tryPrimitive: 100 withArgs: args])].! Item was added: + ----- Method: ContextTest>>testPrimitive117 (in category 'tests - simulatio= n') ----- + testPrimitive117 + "Test simulation of primitive 117 (aka named primitives)." +=20 + "valid 0-arg primitive" + self + assert: (Float32Array withAll: {2.0. 3.0}) sum "<-- primitive 117 (aka na= med primitive)" + equals: (Context runSimulated: [(Float32Array withAll: {2.0. 3.0}) sum]).= "<-- simulator sends tryNamedPrimitiveIn:for:withArgs: (primitive 218)" + =09 + "valid unary primitive" + self + assert: ('wiffy' hashWithInitialHash: 42) + equals: (Context runSimulated: ['wiffy' hashWithInitialHash: 42]). + =09 + "superfluous arguments" + self "cascade!!" + assert: ('wiffy' hashWithInitialHash: 42) + equals: (Context runSimulated: ['wiffy' hashWithInitialHash: 42]); + assert: true.! Item was added: + ----- Method: ContextTest>>testPrimitive118 (in category 'tests - simulatio= n') ----- + testPrimitive118 + "Test simulation of primitive 118." +=20 + self testPrimitive118: [:receiver :primitiveIndex :arguments | + receiver tryPrimitive: primitiveIndex withArgs: arguments]. + =09 + self flag: #bug. "Known bug: Mirror version of primitive 118 currently mis= behaves in the OSVM." + self testPrimitive118: [:receiver :primitiveIndex :arguments | + thisContext receiver: receiver tryPrimitive: primitiveIndex withArgs: arg= uments].! Item was added: + ----- Method: ContextTest>>testPrimitive118: (in category 'tests - simulati= on') ----- + testPrimitive118: primitiveBlock +=20 + | input1 input2 | + { + {#isNil. 62. {}}. "valid 0-arg primitive" + {6. 9. {7}}. "valid unary primitive" + {6. 62. {7}}. "failing primitive" + {6. 'not a primitive'. {7}}. "invalid primitive" + {6. 9. 'not an array'}. "invalid arguments" + {#isNil. 62. {1}}. "too many arguments" + {6. 9. {}}. "missing argument" + =09 + {6. 83. {#=3D. 6.0}}. "primitivePerform" + {6. 83. {#isNil. 'excess arg'}}. "primitivePerform - too many arguments" + {6. 84. {#=3D. {6.0}}}. "primitivePerformWithArgs" + {6. 84. {#isNil. 'excess arg'}}. "primitivePerformWithArgs - invalid argu= ments" + {6. 100. {#=3D. 6.0. Object}}. "primitivePerformInSuperclass" + {6. 100. {#isNil. {'excess arg'}. Object}}. "primitivePerformInSuperclass= - too many arguments" + =09 + {6. 118. {9. {7}}}. "primitiveDoPrimitiveWithArgs" + {6. 118. {9. {7. 13}}}. "primitiveDoPrimitiveWithArgs - superfluous argum= ents" + {6. 118. {118. {9. {7}}}}. "primitiveDoPrimitiveWithArgs - nested invocat= ion" + {thisContext. 218. {Float32Array >> #sum. Float32Array withAll: {2.0. 3.0= }. {}}}. "primitiveDoNamedPrimitiveWithArgs" + {thisContext. 218. {Float32Array >> #sum. Float32Array withAll: {2.0. 3.0= }. {4.0}}}. "primitiveDoNamedPrimitiveWithArgs - superfluous arguments" + } do: [:args | | block | + block :=3D [primitiveBlock valueWithArguments: args]. + self + assert: block value + equals: (Context runSimulated: block)]. + =09 + self + assert: (primitiveBlock value: (input1 :=3D {1. 2. 3}) value: 61 value: {= 2. 4}) + equals: (Context runSimulated: [primitiveBlock value: (input2 :=3D {1. 2= . 3}) value: 61 value: {2. 4}]); + assert: input1 + equals: input2.! Item was added: + ----- Method: ContextTest>>testPrimitive188 (in category 'tests - simulatio= n') ----- + testPrimitive188 + "Test simulation of primitive 188." +=20 + self testPrimitive188: [:receiver :args :compiledMethod | + receiver withArgs: args executeMethod: compiledMethod]. + =09 + self testPrimitive188: [:receiver :args :compiledMethod | + CompiledMethod receiver: receiver withArguments: args executeMethod: comp= iledMethod].! Item was added: + ----- Method: ContextTest>>testPrimitive188: (in category 'tests - simulati= on') ----- + testPrimitive188: primitiveBlock +=20 + | block | + { + {2. {}. SmallInteger >> #even}. "valid 0-arg message" + {2. {1}. Integer >> #<<}. "valid unary message" + {2. {3. 4}. Integer >> #raisedTo:modulo:}. "valid binary message" + {2. 'not an array'. Integer >> #<<}. "invalid arguments" + {2. {'excess arg'}. SmallInteger >> #even}. "too many arguments" + {2. {}. Integer >> #<<}. "missing argument" + {2. {1}. 'not a method'}. "invalid method" + {block :=3D [(primitiveBlock valueWithArguments: {2. {3. 4}. TestObjectFo= rMethod new xxxMethod: thisContext homeMethod}) + allButFirst "OaM selector is undefined behavior"]. {}. block class looku= pSelector: #value} "object as method" + } do: [:args | + self + assert: ([primitiveBlock valueWithArguments: args] on: Error do: [:ex | = ex description]) + equals: (Context runSimulated: [[primitiveBlock valueWithArguments: args= ] on: Error do: [:ex | ex description]])].! Item was added: + ----- Method: ContextTest>>testPrimitive189 (in category 'tests - simulatio= n') ----- + testPrimitive189 + "Test simulation of primitive 118." +=20 + { + [2 executeMethod: SmallInteger >> #even]. "valid 0-arg message" + [2 with: 1 executeMethod: Integer >> #<<]. "valid unary message" + [2 with: 3 with: 4 executeMethod: Integer >> #raisedTo:modulo:]. "valid b= inary message" + [2 with: 1 executeMethod: Integer >> #even]. "too many arguments" + [2 executeMethod: Integer >> #<<]. "missing argument" + [2 with: 1 executeMethod: 'not a method']. "invalid method" + [(2 with: 3 with: 4 executeMethod: (TestObjectForMethod new xxxMethod: th= isContext homeMethod)) + allButFirst "OaM selector is undefined behavior"] "object as method" + } do: [:block | + self + assert: (block on: Error do: [:ex | ex description]) + equals: (Context runSimulated: [block on: Error do: [:ex | ex descriptio= n]])].! Item was added: + ----- Method: ContextTest>>testPrimitive218 (in category 'tests') ----- + testPrimitive218 + "Test usage of primitive 218 through simulation." +=20 + self testPrimitive117. + =09 + "Test simulation of primitive 218." + self simulate: [self testPrimitive117].! Item was changed: + ----- Method: ContextTest>>testPrimitive83 (in category 'tests - simulation= ') ----- - ----- Method: ContextTest>>testPrimitive83 (in category 'tests') ----- testPrimitive83 + "Test simulation of primitive 83." =20 + self flag: #bug. "Known bug: Primitive 83 SPORADICALLY does NOT fail in th= e OSVM for missing argument!!" + =09 { + [nil perform: #isNil]. "valid 0-arg message" + [nil perform: #=3D with: true]. "valid unary message" + [nil perform: #ifNil:ifNotNil: with: [2] with: [:x | x]]. "valid binary m= essage" + [nil perform: #isNil with: 'excess arg']. "too many arguments" + [nil perform: #=3D]. "missing argument" + [nil perform: Object]. "invalid selector" + [[(self class + addSelector: #plonk:with: withMethod: (TestObjectForMethod new xxxMethod= : thisContext homeMethod); + perform: #plonk:with: with: 2 with: 3) allButFirst "OaM selector is unde= fined behavior"] + ensure: [self class removeSelector: #plonk]]. + } do: [:block | - {#isNil}. "valid 0-arg message" - {#=3D. true}. "valid unary message" - {#ifNil:ifNotNil:. [2]. [:x | x]}. "valid binary message" - {#isNil. 'excess arg'}. "too many arguments" - {#=3D}. "missing argument" - } do: [:args | self + assert: (block on: Error do: [:ex | ex description]) + equals: (Context runSimulated: [block on: Error do: [:ex | ex descriptio= n]])].! - assert: (nil tryPrimitive: 83 withArgs: args) - equals: (Context runSimulated: [nil tryPrimitive: 83 withArgs: args])].! Item was changed: + ----- Method: ContextTest>>testPrimitive84 (in category 'tests - simulation= ') ----- - ----- Method: ContextTest>>testPrimitive84 (in category 'tests') ----- testPrimitive84 + "Test simulation of primitive 84." =20 { {#isNil. {}}. "valid 0-arg message" {#=3D. {true}}. "valid unary message" {#ifNil:ifNotNil:. {[2]. [:x | x]}}. "valid binary message" - {#isNil}. "missing arguments" {#isNil. 'not an array'}. "invalid arguments" {#isNil. {'excess arg'}}. "too many arguments" {#=3D. {}}. "missing argument" + {Object. {}}. "invalid selector" + {#in:. + {[:it | + [(self class + addSelector: #plonk:with: withMethod: (TestObjectForMethod new xxxMeth= od: thisContext homeMethod); + perform: #plonk:with: withArguments: #(2 3)) allButFirst "OaM selector= is undefined behavior"] + ensure: [self class removeSelector: #plonk]]}}. } do: [:args | self + assert: ([nil perform: args first withArguments: args second] on: Error = do: [:ex | ex description]) + equals: (Context runSimulated: [[nil perform: args first withArguments: = args second] on: Error do: [:ex | ex description]])].! - assert: (nil tryPrimitive: 84 withArgs: args) - equals: (Context runSimulated: [nil tryPrimitive: 84 withArgs: args])].! Item was added: + ----- Method: ContextTest>>testRestartCallPrimitive (in category 'tests') -= ---- + testRestartCallPrimitive +=20 + | array context start | + array :=3D Array new. + context :=3D [[array at: 1] value] asContext. + [context selector =3D #at:] whileFalse: [context :=3D context step]. + start :=3D context sender. + =09 + array become: (Array with: 42). + context privRefresh. + context :=3D context stepToSendOrReturn. + =09 + self assert: start equals: context. + self assert: context willReturn. + self assert: 42 equals: context top.! Item was added: + ----- Method: ContextTest>>testRunUntilErrorOrReturnFromError (in category = 'tests') ----- + testRunUntilErrorOrReturnFromError +=20 + | context process result sender error | + process :=3D [result :=3D 1 / 0] newProcess. + process runUntil: [:ctxt | ctxt receiver =3D=3D self]. + context :=3D process suspendedContext. + sender :=3D context sender. + =09 + result :=3D context runUntilErrorOrReturnFrom: context. + context :=3D result first. + error :=3D result second. + =09 + self assert: (context hasSender: sender). + self assert: (ZeroDivide handles: error). + =09 + process suspendedContext: context. + process runUntil: [:ctxt | ctxt sender isNil]. + self assert: error identical: result.! Item was added: + ----- Method: ContextTest>>testRunUntilErrorOrReturnFromNoError (in categor= y 'tests') ----- + testRunUntilErrorOrReturnFromNoError +=20 + | context process result sender error | + process :=3D [6 * 7] newProcess. + process runUntil: [:ctxt | ctxt receiver =3D=3D self]. + context :=3D process suspendedContext. + sender :=3D context sender. + =09 + result :=3D context runUntilErrorOrReturnFrom: context. + context :=3D result first. + error :=3D result second. + =09 + self assert: sender equals: context. + self assert: nil equals: error. + self assert: 42 equals: context top.! --===============7928377171753992527==-- From commits@source.squeak.org Sun Feb 25 19:48:48 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1490.mcz Date: Sun, 25 Feb 2024 19:48:35 +0000 Message-ID: <20240225194845.7DBD35840AA@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1408471277781092530==" --===============1408471277781092530== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1490.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1490 Author: ct Time: 22 September 2022, 12:33:25.251935 pm UUID: abcadab7-53c3-f840-a63b-f90658e6a190 Ancestors: Kernel-eem.1488 code simulation: Do not check numArgs in perform primitives. Instead, answer = a primitive fail token from Context>>#send:to:with:lookupIn: if the numbers m= ismatch. See http://lists.squeakfoundation.org/pipermail/squeak-dev/2022-Sept= ember/222245.html. Pros of this advantage: - semantic correctness: Prior to the final method lookup, the VM should not k= now anything about the type of a selector. - optimization: Avoid redundant method lookup. Cons of this advantage: - When simulating an invalid message send instruction, the simulator will no = longer signal a clear 'Wrong number of arguments in simulated message' error = but instead prolong the infection chain until a 'MessageNotUnderstood: Array>= >' exception is signaled by the InstructionStream eventually. Note that such = an invalidation would cause the VM to crash, though, so I don't know how impo= rtant this is. (Example - BEWARE! Only simulate it! block :=3D Compiler evaluate: '[false ifTrue: 2 ifFalse: 3]'. block method literalAt: 1 put: #itest:fTrue:ifFalse:. block value) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-eem.1488 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: Context>>doPrimitive:method:receiver:args: (in category 'priv= ate') ----- doPrimitive: primitiveIndex method: meth receiver: receiver args: arguments "Simulate a primitive method whose index is primitiveIndex. The simulated= receiver and arguments are given as arguments to this message. If successful, push res= ult and return resuming context, else ^ {errCode, PrimitiveFailToken}. Any primitive whi= ch provokes execution needs to be intercepted and simulated to avoid execution runnin= g away." =20 | value | "Judicious use of primitive 19 (a null primitive that doesn't do anything)= prevents the debugger from entering various run-away activities such as spawning a= new process, etc. Injudicious use results in the debugger not being able to = debug interesting code, such as the debugger itself. Hence use primitive 19 wi= th care :-)" "SystemNavigation new browseAllSelect: [:m| m primitive =3D 19]" primitiveIndex =3D 19 ifTrue: [ [self notify: ('The code being simulated is trying to control a process (= {1}). Process controlling cannot be simulated. If you proceed, things may hap= pen outside the observable area of the simulator.' translated format: {meth r= eference})] ifCurtailed: [self push: nil "Cheap fix of the context's internal state"= ]]. =09 ((primitiveIndex between: 201 and: 222) and: [(self objectClass: receiver) includesBehavior: BlockClosure]) ifTru= e: [(primitiveIndex =3D 206 or: [primitiveIndex =3D 208]) ifTrue: "[Full]BlockClosure>>valueWi= thArguments:" [^receiver simulateValueWithArguments: arguments first caller: self]. ((primitiveIndex between: 201 and: 209) "[Full]BlockClosure>>value[:v= alue:...]" or: [primitiveIndex between: 221 and: 222]) ifTrue: "[Full]BlockClosure= >>valueNoContextSwitch[:]" [^receiver simulateValueWithArguments: arguments caller: self]]. =20 primitiveIndex =3D 83 ifTrue: "afr 9/11/1998 19:50" "Object>>perform:[with= :...]" [| selector | selector :=3D arguments at: 1 ifAbsent: [^ self class primitiveFailTokenFor: #'bad argument']. - arguments size - 1 =3D selector numArgs ifFalse: - [^ self class primitiveFailTokenFor: #'bad number of arguments']. ^self send: selector to: receiver with: arguments allButFirst]. primitiveIndex =3D 84 ifTrue: "afr 9/11/1998 19:50 & eem 8/18/2009 17:04" = "Object>>perform:withArguments:" [| selector args | arguments size =3D 2 ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. selector :=3D arguments first. args :=3D arguments second. args isArray ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. - args size =3D selector numArgs ifFalse: - [^ self class primitiveFailTokenFor: #'bad number of arguments']. ^self send: selector to: receiver with: args]. primitiveIndex =3D 100 ifTrue: "eem 8/18/2009 16:57" "Object>>perform:with= Arguments:inSuperclass:" [| rcvr selector args superclass | arguments size caseOf: { [3] -> [ rcvr :=3D receiver. selector :=3D arguments first. args :=3D arguments second. superclass :=3D arguments third]. [4] -> ["mirror primitive" rcvr :=3D arguments first. selector :=3D arguments second. args :=3D arguments third. superclass :=3D arguments fourth] } otherwise: [^ self class primitiveFailTokenFor: #'bad number of argument= s']. args isArray ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. - args size =3D selector numArgs ifFalse: - [^ self class primitiveFailTokenFor: #'bad number of arguments']. ((self objectClass: rcvr) includesBehavior: superclass) ifFalse: [^ self class primitiveFailTokenFor: #'bad argument']. ^self send: selector to: rcvr with: args lookupIn: superclass]. =20 "Mutex>>primitiveEnterCriticalSection Mutex>>primitiveTestAndSetOwnershipOfCriticalSection" (primitiveIndex =3D 186 or: [primitiveIndex =3D 187]) ifTrue: [| effective | effective :=3D Processor activeProcess effectiveProcess. "active =3D=3D effective" value :=3D primitiveIndex =3D 186 ifTrue: [receiver primitiveEnterCriticalSectionOnBehalfOf: effective] ifFalse: [receiver primitiveTestAndSetOwnershipOfCriticalSectionOnBeha= lfOf: effective]. ^(self isPrimFailToken: value) ifTrue: [value] ifFalse: [self push: value]]. =20 primitiveIndex =3D 188 ifTrue: "Object>>withArgs:executeMethod: CompiledMethod class>>receiver:withArguments:executeMethod: VMMirror>>ifFail:object:with:executeMethod: et al" [| n args methodArg thisReceiver | ((n :=3D arguments size) between: 2 and: 4) ifFalse: [^self class primitiveFailTokenFor: #'unsupported operation']. ((self objectClass: (args :=3D arguments at: n - 1)) =3D=3D Array and: [(self objectClass: (methodArg :=3D arguments at: n)) includesBeha= vior: CompiledMethod]) ifFalse: [^self class primitiveFailTokenFor: #'bad argument']. methodArg numArgs =3D args size ifFalse: [^self class primitiveFailTokenFor: #'bad number of arguments']. thisReceiver :=3D arguments at: n - 2 ifAbsent: [receiver]. methodArg primitive > 0 ifTrue: [methodArg isQuick ifTrue: [^self push: (methodArg valueWithReceiver: thisReceiver arguments: args= )]. ^self doPrimitive: methodArg primitive method: methodArg receiver: this= Receiver args: args]. ^self activateMethod: methodArg withArgs: args receiver: thisReceiver]. =20 primitiveIndex =3D 118 ifTrue: "[receiver:]tryPrimitive:withArgs:; avoid r= ecursing in the VM" [(arguments size =3D 3 and: [(self objectClass: arguments second) =3D=3D SmallInteger and: [(self objectClass: arguments last) =3D=3D Array]]) ifTrue: [^self doPrimitive: arguments second method: meth receiver: arguments fi= rst args: arguments last]. (arguments size =3D 2 and: [(self objectClass: arguments first) =3D=3D SmallInteger and: [(self objectClass: arguments last) =3D=3D Array]]) ifFalse: [^self class primitiveFailTokenFor: nil]. ^self doPrimitive: arguments first method: meth receiver: receiver args:= arguments last]. =20 value :=3D primitiveIndex =3D 120 "FFI method" ifTrue: [(meth literalAt: 1) tryInvokeWithArguments: arguments] ifFalse: [primitiveIndex =3D 117 "named primitives" ifTrue: [self tryNamedPrimitiveIn: meth for: receiver withArgs: argum= ents] ifFalse: "should use self receiver: receiver tryPrimitive: primitiveI= ndex withArgs: arguments but this is only in later VMs (and appears to be bro= ken)" [receiver tryPrimitive: primitiveIndex withArgs: arguments]]. =20 ^(self isPrimFailToken: value) ifTrue: [value] ifFalse: [self push: value]! Item was changed: ----- Method: Context>>send:to:with:lookupIn: (in category 'controlling') -= ---- send: selector to: rcvr with: arguments lookupIn: lookupClass "Simulate the action of sending a message with selector and arguments to r= cvr. The argument, lookupClass, is the class in which to lookup the message. = This is the receiver's class for normal messages, but for super messages it w= ill be some specific class related to the source method." =20 | meth primIndex val ctxt | (meth :=3D lookupClass lookupSelector: selector) ifNil: [selector =3D=3D #doesNotUnderstand: ifTrue: [self error: 'Recursive message not understood!!' translated]. ^self send: #doesNotUnderstand: to: rcvr with: {(Message selector: selector arguments: arguments) lookupClass: l= ookupClass} lookupIn: lookupClass]. =09 (self objectClass: meth) isCompiledCodeClass ifFalse: ["Object as Methods (OaM) protocol: 'The contract is that, when the VM en= counters an ordinary object (rather than a compiled method) in the method dic= tionary during lookup, it sends it the special selector #run:with:in: providi= ng the original selector, arguments, and receiver.'. DOI: 10.1145/2991041.299= 1062." ^self send: #run:with:in: to: meth with: {selector. arguments. rcvr}]. =09 meth numArgs =3D arguments size ifFalse: + [^ self class primitiveFailTokenFor: #'bad number of arguments']. - [^ self error: ('Wrong number of arguments in simulated message {1}' tran= slated format: {selector})]. (primIndex :=3D meth primitive) > 0 ifTrue: [val :=3D self doPrimitive: primIndex method: meth receiver: rcvr args: a= rguments. (self isPrimFailToken: val) ifFalse: [^val]]. =09 ctxt :=3D self activateMethod: meth withArgs: arguments receiver: rcvr. (primIndex isInteger and: [primIndex > 0]) ifTrue: [ctxt failPrimitiveWith: val]. =09 ^ctxt! --===============1408471277781092530==-- From commits@source.squeak.org Sun Feb 25 19:50:31 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Tools-ct.1245.mcz Date: Sun, 25 Feb 2024 19:50:21 +0000 Message-ID: <20240225195029.D1E385840B0@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4707763198147621886==" --===============4707763198147621886== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Tools to project The Trunk: http://source.squeak.org/trunk/Tools-ct.1245.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Tools-ct.1245 Author: ct Time: 30 December 2023, 8:52:32.810665 pm UUID: 2a87a721-9966-6f46-abea-4e240d9f5ecd Ancestors: Tools-ct.1244 Complements Kernel-ct.1546 (fixes stepping through #mustBeBoolean errors and = restarting from primitive methods that no longer fail). =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Tools-ct.1244 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: Debugger>>contents:notifying: (in category 'accessing') ----- contents: aText notifying: aController "Accept new method source of the selected context." =20 | selector classOfMethod category ctxt newMethod | contextStackIndex =3D 0 ifTrue: [^ false]. =09 "First, handle some edge cases" selector :=3D self selectedClass newParser parseSelector: aText. "selector isDoIt ifTrue: [ currentCompiledMethod :=3D self compileDoIt: aText]." self flag: #todo. "ct: Recompile doIt method *without* creating method lit= ters!! See Compiler>>#evaluateCue:ifFail:." selector =3D self selectedMessageName ifFalse: [ "Different message compiled, delegating to super" ^ super contents: aText notifying: aController]. =09 self selectedContext isExecutingBlock ifTrue: [ "If we are in a block context, we need to rewind the stack before ." | home | home :=3D self selectedContext activeHome. home ifNil: [ (self confirm: 'Method for block not found on stack, can''t edit and con= tinue. Update method anyway?' translated) ifFalse: [ ^ false]. ^ (super contents: aText notifying: aController) ifTrue: [ contents :=3D nil. self contentsChanged. self inform: 'Method was updated, but cannot revert the stack to it.' = translated]; yourself]. (self confirm: 'I will have to revert to the method from\which this block= originated. Is that OK?' translated withCRs) ifFalse: [ ^ false]. =09 self resetContext: home changeContents: false. "N.B. Only reset the contents if the compilation succeeds. If contents wo= uld be reset when compilation fails, both compiler error message and modifica= tions were lost." ^ (self contents: aText notifying: aController) ifTrue: [self contentsChanged]; yourself]. =09 classOfMethod :=3D self selectedClass. category :=3D self selectedMessageCategoryName. =09 "Do the actual compilation" selector :=3D classOfMethod compile: aText classified: category notifying: aController. selector ifNil: [^ false]. "compilation cancelled" =09 "Update views" contents :=3D aText. newMethod :=3D classOfMethod compiledMethodAt: selector. newMethod isQuick ifTrue: [ self cutBackExecutionToSenderContext]. ctxt :=3D interruptedProcess popTo: self selectedContext. ctxt =3D=3D self selectedContext ifFalse: [self inform: 'Method saved, but current context unchanged\becau= se of unwind error. Click OK to see error' translated withCRs] ifTrue: [ newMethod isQuick ifFalse: [ + ctxt :=3D interruptedProcess restartTopWith: newMethod. + ctxt :=3D interruptedProcess stepToSendOrReturn]. - interruptedProcess restartTopWith: newMethod. - interruptedProcess stepToSendOrReturn]. contextVariablesInspector object: nil]. self resetContext: ctxt. =09 Project current addDeferredUIMessage: [ self changed: #contentsSelection]. ^ true! Item was changed: ----- Method: Debugger>>tryRestartFrom: (in category 'context stack menu') = ----- tryRestartFrom: context "Try to restart from the initial state of the context. Return whether an unwind error occurred." =20 | actualContext unwindError | actualContext :=3D interruptedProcess popTo: context. unwindError :=3D actualContext ~=3D context. unwindError ifFalse: [ + actualContext :=3D interruptedProcess restartTop; stepToSendOrReturn]. - interruptedProcess restartTop; stepToSendOrReturn]. self resetContext: actualContext. ^ unwindError! --===============4707763198147621886==-- From commits@source.squeak.org Sun Feb 25 19:52:31 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1546.mcz Date: Sun, 25 Feb 2024 19:52:17 +0000 Message-ID: <20240225195229.917A65840DF@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6012611835352700350==" --===============6012611835352700350== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1546.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1546 Author: ct Time: 30 December 2023, 8:52:22.257665 pm UUID: 0c54d495-74a1-cd4e-8c0f-f95dec89f2a1 Ancestors: Kernel-ct.1545 In the debugger/simulator, fixes stepping through #mustBeBoolean errors and r= estarting from primitive methods that no longer fail. There is no need to thr= ow up another debugger here. Just continue with the new context, and the clie= nt (i.e., the debugger) must honor the answer of #stepToSendOrReturn. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-ct.1545 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: Context>>stepToSendOrReturn (in category 'system simulation')= ----- stepToSendOrReturn "Simulate the execution of bytecodes until either sending a message or=20 returning a value to the receiver (that is, until switching contexts)." =20 | ctxt | [self willReallySend or: [self willReturn or: [self willReallyStore]]] whi= leFalse: [ctxt :=3D self step. ctxt =3D=3D self ifFalse: + ["Caused by mustBeBoolean handling or callPrimitive:" + ^ctxt stepToSendOrReturn]]! - [self halt.=20 - "Caused by mustBeBoolean handling" - ^ctxt]]! --===============6012611835352700350==-- From commits@source.squeak.org Sun Feb 25 20:10:25 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1547.mcz Date: Sun, 25 Feb 2024 20:10:08 +0000 Message-ID: <20240225201023.42D28584053@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7578259026403030830==" --===============7578259026403030830== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1547.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1547 Author: ct Time: 30 December 2023, 8:54:13.166665 pm UUID: 60bc9f54-c12a-4545-9ff9-b3d2875784cd Ancestors: Kernel-ct.1545 Proposal: When simulating #mustBeBoolean errors, send #mustBeBoolean instead = of #mustBeBooleanIn: just like the VM. I don't see any harm in this. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-ct.1545 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: Context>>jump:if: (in category 'instruction decoding') ----- jump: distance if: condition=20 "Simulate the action of a 'conditional jump' bytecode whose offset is the = argument, distance, and whose condition is the argument, condition." =20 | bool | bool :=3D self pop. condition =3D=3D bool ifTrue: [self jump: distance] ifFalse: [(true =3D=3D bool or: [false =3D=3D bool]) ifFalse: + [^self send: #mustBeBoolean to: bool with: #()]]! - [^self send: #mustBeBooleanIn: to: bool with: {self}]]! --===============7578259026403030830==-- From commits@source.squeak.org Sun Feb 25 20:11:19 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Monticello-ct.808.mcz Date: Sun, 25 Feb 2024 20:11:05 +0000 Message-ID: <20240225201116.BF6545840FA@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3277151842056960823==" --===============3277151842056960823== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Christoph Thiede uploaded a new version of Monticello to project The Trunk: http://source.squeak.org/trunk/Monticello-ct.808.mcz ==================== Summary ==================== Name: Monticello-ct.808 Author: ct Time: 25 February 2024, 9:10:40.513023 pm UUID: d9aa0fc7-caea-2841-8275-b462e51158e9 Ancestors: Monticello-cmm.807 In repository inspector, updates version list after adopting a version. =============== Diff against Monticello-cmm.807 =============== Item was added: + ----- Method: MCRepositoryInspector>>adopt (in category 'actions') ----- + adopt + super adopt. + self refresh.! --===============3277151842056960823==-- From commits@source.squeak.org Sun Feb 25 20:12:35 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Kernel-ct.1548.mcz Date: Sun, 25 Feb 2024 20:12:24 +0000 Message-ID: <20240225201232.B3DC55840F0@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3645368544052584318==" --===============3645368544052584318== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ct.1548.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Kernel-ct.1548 Author: ct Time: 30 December 2023, 8:57:59.873665 pm UUID: 0b32cb51-9e96-d247-be53-734ad1f2735f Ancestors: Kernel-ct.1545 Proposal: Resolves #mustBeBoolean errors for copies or proxies for true and f= alse. For instance, the following now works: True basicNew ifTrue: [1] ifFalse: [2]. (ObjectTracer on: false) ifTrue: [1] ifFalse: [2]. See: https://lists.squeakfoundation.org/archives/list/squeak-dev(a)lists.sque= akfoundation.org/thread/GHO33PJVH3MDYYRDRRZCQIPMZLW2Y7VL/ =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Kernel-ct.1545 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: False>>mustBeBooleanIn: (in category 'as yet unclassified') -= ---- + mustBeBooleanIn: aContext +=20 + aContext skipBackBeforeJump. + ^ false! Item was added: + ----- Method: ObjectTracer>>mustBeBoolean (in category 'very few messages')= ----- + mustBeBoolean + "Overwritten to preserve original sender context." +=20 + ^ self mustBeBooleanIn: thisContext sender! Item was added: + ----- Method: True>>mustBeBooleanIn: (in category 'as yet unclassified') --= --- + mustBeBooleanIn: aContext +=20 + aContext skipBackBeforeJump. + ^ true! --===============3645368544052584318==-- From commits@source.squeak.org Sun Feb 25 20:15:53 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: KernelTests-ct.409.mcz Date: Sun, 25 Feb 2024 20:15:38 +0000 Message-ID: <20240225201551.9BB165840F7@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8627791009904280594==" --===============8627791009904280594== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of KernelTests to project The Trunk: http://source.squeak.org/trunk/KernelTests-ct.409.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: KernelTests-ct.409 Author: ct Time: 10 November 2021, 1:45:40.105242 am UUID: ab3db7b1-d980-5b4b-80a2-8c08bef9b23b Ancestors: KernelTests-mt.407 Adds new simulation tests for the reflection primitives 117 (primitiveExterna= lCall), 118 (primitiveDoPrimitiveWithArgs), and 218 (primitiveDoNamedPrimitiv= eWithArgs) and revises existing tests for the primitives 83 (primitivePerform= ), 84 (primitivePerformWithArgs), and 100 (primitivePerformInSuperclass) whic= h do not need to be dispatched via primitive 118. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against KernelTests-mt.407= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: ContextTest>>testPrimitive100 (in category 'tests') ----- testPrimitive100 =20 { {#isNil. {}. Object}. "valid 0-arg message" {#=3D. {true}. UndefinedObject}. "valid unary message" {#ifNil:ifNotNil:. {[2]. [:x | x]}. Object}. "valid binary message" {{}. #=3D. {true}. SequenceableCollection}. "mirror primitive" + {'not a selector'. {}. Object}. "invalid selector" + {#isNil. 'not an array'. Object}. "invalid arguments" - {#isNil}. "missing arguments" - {#isNil. 'not an array'}. "invalid arguments" - {#isNil. {}}. "missing lookupClass" {#isNil. {'excess arg'}. Object}. "too many arguments" {#=3D. {}. UndefinedObject}. "missing argument" + {#isNil. {}. 'not a class'}. "invalid lookupClass" {#isNil. {}. Boolean}. "lookupClass not in inheritance chain" + } do: [:args | | block | + block :=3D [[nil + perform: args first + withArguments: args second + inSuperclass: args third] + on: Error do: [:ex | ex messageText]]. - } do: [:args | self + assert: block value + equals: (Context runSimulated: block). + =09 + block :=3D [[thisContext + object: nil + perform: args first + withArguments: args second + inClass: args third] + on: Error do: [:ex | ex messageText]]. + self + assert: block value + equals: (Context runSimulated: block)].! - assert: (nil tryPrimitive: 100 withArgs: args) - equals: (Context runSimulated: [nil tryPrimitive: 100 withArgs: args])].! Item was added: + ----- Method: ContextTest>>testPrimitive117 (in category 'tests') ----- + testPrimitive117 +=20 + | input1 input2 | + "valid 0-arg primitive" + self + assert: #isNil size + equals: (Context runSimulated: [#isNil size]). + =09 + "valid unary primitive" + self + assert: 6 + 9 + equals: (Context runSimulated: [6 + 9]). + =09 + "superfluous arguments" + self "cascade!!" + assert: 6 + 9 + equals: (Context runSimulated: [6 + 9]); + assert: true. + =09 + self + assert: ((input1 :=3D {1. 2. 3}) at: 2 put: 4) + equals: (Context runSimulated: [(input2 :=3D {1. 2. 3}) at: 2 put: 4]); + assert: input1 + equals: input2.! Item was added: + ----- Method: ContextTest>>testPrimitive118 (in category 'tests') ----- + testPrimitive118 +=20 + self testPrimitive118: [:receiver :primitiveIndex :arguments | + receiver tryPrimitive: primitiveIndex withArgs: arguments]. + =09 + self testPrimitive118: [:receiver :primitiveIndex :arguments | + thisContext receiver: receiver tryPrimitive: primitiveIndex withArgs: arg= uments].! Item was added: + ----- Method: ContextTest>>testPrimitive118: (in category 'tests') ----- + testPrimitive118: primitiveBlock +=20 + | input1 input2 | + { + {#isNil. 62. {}}. "valid 0-arg primitive" + {6. 9. {7}}. "valid unary primitive" + {6. 62. {7}}. "failing primitive" + {6. 'not a primitive'. {7}}. "invalid primitive" + {6. 9. 'not an array'}. "invalid arguments" + {#isNil. 62. {1}}. "too many arguments" + {6. 9. {}}. "missing argument" + =09 + {nil. 83. {#=3D. true}}. "primitivePerform" + {nil. 83. {#isNil. 'excess arg'}}. "primitivePerform - too many arguments" + {nil. 84. {#=3D. {true}}}. "primitivePerformWithArgs" + {nil. 84. {#isNil. 'excess arg'}}. "primitivePerformWithArgs - invalid ar= guments" + {nil. 100. {#=3D. true. Object}}. "primitivePerformInSuperclass" + {nil. 100. {#isNil. {'excess arg'}. Object}}. "primitivePerformInSupercla= ss - too many arguments" + =09 + {6. 118. {9. {7}}}. "primitiveDoPrimitiveWithArgs" + {6. 118. {9. {7. 13}}}. "primitiveDoPrimitiveWithArgs - superfluous argum= ents" + {6. 118. {118. {9. {7}}}}. "primitiveDoPrimitiveWithArgs - M3" + {thisContext. 218. {Float32Array >> #sum. Float32Array withAll: {2.0. 3.0= }. {}}}. "primitiveDoNamedPrimitiveWithArgs" + {thisContext. 218. {Float32Array >> #sum. Float32Array withAll: {2.0. 3.0= }. {4.0}}}. "primitiveDoNamedPrimitiveWithArgs - superfluous arguments" + } do: [:args | | block | + block :=3D [primitiveBlock valueWithArguments: args]. + self + assert: block value + equals: (Context runSimulated: block)]. + =09 + self + assert: (primitiveBlock value: (input1 :=3D {1. 2. 3}) value: 61 value: {= 2. 4}) + equals: (Context runSimulated: [primitiveBlock value: (input2 :=3D {1. 2= . 3}) value: 61 value: {2. 4}]); + assert: input1 + equals: input2.! Item was added: + ----- Method: ContextTest>>testPrimitive218 (in category 'tests') ----- + testPrimitive218 +=20 + "valid 0-arg primitive" + self + assert: (Float32Array withAll: {2.0. 3.0}) sum + equals: (Context runSimulated: [(Float32Array withAll: {2.0. 3.0}) sum]). + =09 + "valid unary primitive" + self + assert: 'wiffy' =3D 'wiffy' copy + equals: (Context runSimulated: ['wiffy' =3D 'wiffy' copy]); + assert: 'wiffy' =3D 'ziffy' + equals: (Context runSimulated: ['wiffy' =3D 'ziffy']). + =09 + "superfluous arguments" + self "cascade!!" + assert: 'wiffy' =3D 'wiffy' copy + equals: (Context runSimulated: ['wiffy' =3D 'wiffy' copy]); + assert: true.! Item was changed: ----- Method: ContextTest>>testPrimitive83 (in category 'tests') ----- testPrimitive83 =20 { + [nil perform: #isNil]. "valid 0-arg message" + [nil perform: #=3D with: true]. "valid unary message" + [nil perform: #ifNil:ifNotNil: with: [2] with: [:x | x]]. "valid binary m= essage" + [nil perform: #isNil with: 'excess arg']. "too many arguments" + [nil perform: #=3D] + } do: [:block | - {#isNil}. "valid 0-arg message" - {#=3D. true}. "valid unary message" - {#ifNil:ifNotNil:. [2]. [:x | x]}. "valid binary message" - {#isNil. 'excess arg'}. "too many arguments" - {#=3D}. "missing argument" - } do: [:args | self + assert: (block on: Error do: [:ex | ex messageText]) + equals: (Context runSimulated: [block on: Error do: [:ex | ex messageTex= t]])].! - assert: (nil tryPrimitive: 83 withArgs: args) - equals: (Context runSimulated: [nil tryPrimitive: 83 withArgs: args])].! Item was changed: ----- Method: ContextTest>>testPrimitive84 (in category 'tests') ----- testPrimitive84 =20 { {#isNil. {}}. "valid 0-arg message" {#=3D. {true}}. "valid unary message" {#ifNil:ifNotNil:. {[2]. [:x | x]}}. "valid binary message" - {#isNil}. "missing arguments" {#isNil. 'not an array'}. "invalid arguments" {#isNil. {'excess arg'}}. "too many arguments" {#=3D. {}}. "missing argument" } do: [:args | self + assert: ([nil perform: args first withArguments: args second] on: Error = do: [:ex | ex messageText]) + equals: (Context runSimulated: [[nil perform: args first withArguments: = args second] on: Error do: [:ex | ex messageText]])].! - assert: (nil tryPrimitive: 84 withArgs: args) - equals: (Context runSimulated: [nil tryPrimitive: 84 withArgs: args])].! --===============8627791009904280594==-- From commits@source.squeak.org Mon Feb 26 14:58:03 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: KernelTests-ct.417.mcz Date: Mon, 26 Feb 2024 14:57:55 +0000 Message-ID: <20240226145801.48168583ED0@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7818698350204235636==" --===============7818698350204235636== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of KernelTests to project The Trunk: http://source.squeak.org/trunk/KernelTests-ct.417.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: KernelTests-ct.417 Author: ct Time: 29 December 2021, 6:16:09.754165 pm UUID: 3f9894ac-a774-b44d-85bf-0846ac062cb2 Ancestors: KernelTests-ct.416 Acceptance tests for #runUntilErrorOrReturnFrom:. Given the complexity of the underlying method, I would like to gently request= a short feedback from the author (Eliot) whether all assumptions in these te= sts are correct. :-) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against KernelTests-ct.416= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: ContextTest>>testRunUntilErrorOrReturnFromError (in category = 'tests') ----- + testRunUntilErrorOrReturnFromError +=20 + | context process result sender error | + process :=3D [self error] newProcess. + process runUntil: [:ctxt | ctxt receiver =3D=3D self]. + context :=3D process suspendedContext. + sender :=3D context sender. + =09 + result :=3D context runUntilErrorOrReturnFrom: context. + context :=3D result first. + error :=3D result second. + =09 + self assert: (context hasSender: sender). + self assert: (Error handles: error).! Item was added: + ----- Method: ContextTest>>testRunUntilErrorOrReturnFromNoError (in categor= y 'tests') ----- + testRunUntilErrorOrReturnFromNoError +=20 + | context process result sender error | + process :=3D [6 * 7] newProcess. + process runUntil: [:ctxt | ctxt receiver =3D=3D self]. + context :=3D process suspendedContext. + sender :=3D context sender. + =09 + result :=3D context runUntilErrorOrReturnFrom: context. + context :=3D result first. + error :=3D result second. + =09 + self assert: sender equals: context. + self assert: nil equals: error. + self assert: 42 equals: context top.! --===============7818698350204235636==-- From commits@source.squeak.org Mon Feb 26 14:58:21 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: KernelTests-ct.421.mcz Date: Mon, 26 Feb 2024 14:58:13 +0000 Message-ID: <20240226145818.A645257E5BB@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3678684666679890138==" --===============3678684666679890138== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of KernelTests to project The Trunk: http://source.squeak.org/trunk/KernelTests-ct.421.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: KernelTests-ct.421 Author: ct Time: 12 March 2022, 1:39:59.553359 am UUID: 3916242e-4ff0-0541-9da6-e876e740d0ad Ancestors: KernelTests-ct.420 Tests handling of objects as methods (OaM) during simulation of Object>>#with= Args:executeMethod: and Object>>#with:...executeMethod:. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against KernelTests-ct.419= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: ContextTest>>testPrimitive188 (in category 'tests') ----- + testPrimitive188 +=20 + self testPrimitive188: [:receiver :args :compiledMethod | + receiver withArgs: args executeMethod: compiledMethod]. + =09 + self testPrimitive188: [:receiver :args :compiledMethod | + CompiledMethod receiver: receiver withArguments: args executeMethod: comp= iledMethod].! Item was added: + ----- Method: ContextTest>>testPrimitive188: (in category 'tests') ----- + testPrimitive188: primitiveBlock +=20 + | block | + { + {2. {}. SmallInteger >> #even}. "valid 0-arg message" + {2. {1}. Integer >> #<<}. "valid unary message" + {2. {3. 4}. Integer >> #raisedTo:modulo:}. "valid binary message" + {2. 'not an array'. Integer >> #<<}. "invalid arguments" + {2. {'excess arg'}. SmallInteger >> #even}. "too many arguments" + {2. {}. Integer >> #<<}. "missing argument" + {2. {1}. 'not a method'}. "invalid method" + {block :=3D [(primitiveBlock valueWithArguments: {2. {3. 4}. TestObjectFo= rMethod new xxxMethod: thisContext homeMethod}) + allButFirst "OaM selector is undefined behavior"]. {}. block class looku= pSelector: #value} "object as method" + } do: [:args | + self + assert: ([primitiveBlock valueWithArguments: args] on: Error do: [:ex | = ex messageText]) + equals: (Context runSimulated: [[primitiveBlock valueWithArguments: args= ] on: Error do: [:ex | ex messageText]])].! Item was added: + ----- Method: ContextTest>>testPrimitive189 (in category 'tests') ----- + testPrimitive189 +=20 + { + [2 executeMethod: SmallInteger >> #even]. "valid 0-arg message" + [2 with: 1 executeMethod: Integer >> #<<]. "valid unary message" + [2 with: 3 with: 4 executeMethod: Integer >> #raisedTo:modulo:]. "valid b= inary message" + [2 with: 1 executeMethod: Integer >> #even]. "too many arguments" + [2 executeMethod: Integer >> #<<]. "missing argument" + [2 with: 1 executeMethod: 'not a method']. "invalid method" + [(2 with: 3 with: 4 executeMethod: (TestObjectForMethod new xxxMethod: th= isContext homeMethod)) + allButFirst "OaM selector is undefined behavior"] "object as method" + } do: [:block | + self + assert: (block on: Error do: [:ex | ex messageText]) + equals: (Context runSimulated: [block on: Error do: [:ex | ex messageTex= t]])].! --===============3678684666679890138==-- From commits@source.squeak.org Mon Feb 26 14:58:45 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: KernelTests-ct.448.mcz Date: Mon, 26 Feb 2024 14:58:37 +0000 Message-ID: <20240226145843.036BB5840DE@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4321897197892790762==" --===============4321897197892790762== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of KernelTests to project The Trunk: http://source.squeak.org/trunk/KernelTests-ct.448.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: KernelTests-ct.448 Author: ct Time: 30 December 2023, 8:52:58.484665 pm UUID: 01009ca0-df8f-7245-9e58-56846dcbbd70 Ancestors: KernelTests-jar.447 Complements Kernel-ct.1546 (fixes stepping through #mustBeBoolean errors and = restarting from primitive methods that no longer fail). =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against KernelTests-jar.44= 7 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: ContextTest>>testRestartCallPrimitive (in category 'tests') -= ---- + testRestartCallPrimitive +=20 + | array context start | + array :=3D Array new: 0. + context :=3D [[array at: 1] value] asContext. + [context selector =3D #at:] whileFalse: [context :=3D context step]. + start :=3D context sender. + =09 + array become: (Array with: 42). + context privRefresh. + context :=3D context stepToSendOrReturn. + =09 + self assert: start equals: context. + self assert: context willReturn. + self assert: 42 equals: context top.! --===============4321897197892790762==-- From commits@source.squeak.org Mon Feb 26 15:00:23 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Tools-ct.1246.mcz Date: Mon, 26 Feb 2024 15:00:11 +0000 Message-ID: <20240226150021.552E4584153@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7269831682774059027==" --===============7269831682774059027== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of Tools to project The Trunk: http://source.squeak.org/trunk/Tools-ct.1246.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Tools-ct.1246 Author: ct Time: 26 February 2024, 4:00:04.757882 pm UUID: fbc966c6-6300-9846-be17-593f1a2530d6 Ancestors: Tools-ct.1245 Fixes slip from Tools-ct.1245. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Tools-ct.1245 =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: Debugger>>contents:notifying: (in category 'accessing') ----- contents: aText notifying: aController "Accept new method source of the selected context." =20 | selector classOfMethod category ctxt newMethod | contextStackIndex =3D 0 ifTrue: [^ false]. =09 "First, handle some edge cases" selector :=3D self selectedClass newParser parseSelector: aText. "selector isDoIt ifTrue: [ currentCompiledMethod :=3D self compileDoIt: aText]." self flag: #todo. "ct: Recompile doIt method *without* creating method lit= ters!! See Compiler>>#evaluateCue:ifFail:." selector =3D self selectedMessageName ifFalse: [ "Different message compiled, delegating to super" ^ super contents: aText notifying: aController]. =09 self selectedContext isExecutingBlock ifTrue: [ "If we are in a block context, we need to rewind the stack before ." | home | home :=3D self selectedContext activeHome. home ifNil: [ (self confirm: 'Method for block not found on stack, can''t edit and con= tinue. Update method anyway?' translated) ifFalse: [ ^ false]. ^ (super contents: aText notifying: aController) ifTrue: [ contents :=3D nil. self contentsChanged. self inform: 'Method was updated, but cannot revert the stack to it.' = translated]; yourself]. (self confirm: 'I will have to revert to the method from\which this block= originated. Is that OK?' translated withCRs) ifFalse: [ ^ false]. =09 self resetContext: home changeContents: false. "N.B. Only reset the contents if the compilation succeeds. If contents wo= uld be reset when compilation fails, both compiler error message and modifica= tions were lost." ^ (self contents: aText notifying: aController) ifTrue: [self contentsChanged]; yourself]. =09 classOfMethod :=3D self selectedClass. category :=3D self selectedMessageCategoryName. =09 "Do the actual compilation" selector :=3D classOfMethod compile: aText classified: category notifying: aController. selector ifNil: [^ false]. "compilation cancelled" =09 "Update views" contents :=3D aText. newMethod :=3D classOfMethod compiledMethodAt: selector. newMethod isQuick ifTrue: [ self cutBackExecutionToSenderContext]. ctxt :=3D interruptedProcess popTo: self selectedContext. ctxt =3D=3D self selectedContext ifFalse: [self inform: 'Method saved, but current context unchanged\becau= se of unwind error. Click OK to see error' translated withCRs] ifTrue: [ newMethod isQuick ifFalse: [ + interruptedProcess restartTopWith: newMethod. - ctxt :=3D interruptedProcess restartTopWith: newMethod. ctxt :=3D interruptedProcess stepToSendOrReturn]. contextVariablesInspector object: nil]. self resetContext: ctxt. =09 Project current addDeferredUIMessage: [ self changed: #contentsSelection]. ^ true! --===============7269831682774059027==-- From commits@source.squeak.org Mon Feb 26 16:53:43 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: KernelTests-ct.454.mcz Date: Mon, 26 Feb 2024 16:53:35 +0000 Message-ID: <20240226165341.4746C5826B3@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1946696637010959960==" --===============1946696637010959960== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of KernelTests to project The Trunk: http://source.squeak.org/trunk/KernelTests-ct.454.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: KernelTests-ct.454 Author: ct Time: 26 February 2024, 5:53:27.913882 pm UUID: 0c12327f-5f0d-454e-bffd-88918727238c Ancestors: KernelTests-ct.453 Fixes slips from KernelTests-ct.453: * Correct tear-down of temporary methods * Speed up ContextTest>>simulate: (avoid dependency on primitiveSuspendBackin= gUpV2) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against KernelTests-ct.453= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: ContextTest>>simulate: (in category 'private') ----- simulate: aBlock =20 + | results | + [results :=3D {aBlock value}] newProcess runUntil: [:ctxt | results notNil= ]. + ^ results first! - | result | - [result :=3D aBlock value] newProcess runUntil: [:ctxt | false]. - ^ result! Item was changed: ----- Method: ContextTest>>testPrimitive83 (in category 'tests - simulation= ') ----- testPrimitive83 "Test simulation of primitive 83." =20 self flag: #bug. "Known bug: Primitive 83 SPORADICALLY does NOT fail in th= e OSVM for missing argument!!" =09 { [nil perform: #isNil]. "valid 0-arg message" [nil perform: #=3D with: true]. "valid unary message" [nil perform: #ifNil:ifNotNil: with: [2] with: [:x | x]]. "valid binary m= essage" [nil perform: #isNil with: 'excess arg']. "too many arguments" [nil perform: #=3D]. "missing argument" [nil perform: Object]. "invalid selector" [[(self class addSelector: #plonk:with: withMethod: (TestObjectForMethod new xxxMethod= : thisContext homeMethod); perform: #plonk:with: with: 2 with: 3) allButFirst "OaM selector is unde= fined behavior"] + ensure: [self class removeSelector: #plonk:with:]]. - ensure: [self class removeSelector: #plonk]]. } do: [:block | self assert: (block on: Error do: [:ex | ex description]) equals: (Context runSimulated: [block on: Error do: [:ex | ex descriptio= n]])].! Item was changed: ----- Method: ContextTest>>testPrimitive84 (in category 'tests - simulation= ') ----- testPrimitive84 "Test simulation of primitive 84." =20 { {#isNil. {}}. "valid 0-arg message" {#=3D. {true}}. "valid unary message" {#ifNil:ifNotNil:. {[2]. [:x | x]}}. "valid binary message" {#isNil. 'not an array'}. "invalid arguments" {#isNil. {'excess arg'}}. "too many arguments" {#=3D. {}}. "missing argument" {Object. {}}. "invalid selector" {#in:. {[:it | [(self class addSelector: #plonk:with: withMethod: (TestObjectForMethod new xxxMeth= od: thisContext homeMethod); perform: #plonk:with: withArguments: #(2 3)) allButFirst "OaM selector= is undefined behavior"] + ensure: [self class removeSelector: #plonk:with:]]}}. - ensure: [self class removeSelector: #plonk]]}}. } do: [:args | self assert: ([nil perform: args first withArguments: args second] on: Error = do: [:ex | ex description]) equals: (Context runSimulated: [[nil perform: args first withArguments: = args second] on: Error do: [:ex | ex description]])].! --===============1946696637010959960==-- From commits@source.squeak.org Tue Feb 27 03:31:03 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: System-cmm.1449.mcz Date: Tue, 27 Feb 2024 03:30:53 +0000 Message-ID: <20240227033100.CFEA4583C16@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4414762244324339929==" --===============4414762244324339929== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Chris Muller uploaded a new version of System to project The Trunk: http://source.squeak.org/trunk/System-cmm.1449.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: System-cmm.1449 Author: cmm Time: 26 February 2024, 9:30:48.069874 pm UUID: 36e12e44-7aca-4655-ab39-72363788d382 Ancestors: System-dtl.1448 Revert cmm.1447 because #cr is always what should be written in platform-inde= pendent Squeak code, and letting the particular FileStream handle the line-en= d conversion. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against System-dtl.1448 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: CodeLoader>>installSourceFile: (in category 'installing') ---= -- installSourceFile: aStream "Install the previously loaded source file" | contents trusted | aStream ifNil:[^self error:'No content to install']. trusted :=3D SecurityManager default positionToSecureContentsOf: aStream. trusted ifFalse:[(SecurityManager default enterRestrictedMode)=20 ifFalse:[ aStream close. ^ self error:'Insecure content encountered']]. contents :=3D self allButShebangLine: aStream upToEnd unzipped asString. (aStream respondsTo: #close) ifTrue:[aStream close]. ^[contents readStream fileIn]=20 on: SyntaxErrorNotification=20 do: [ : err | Smalltalk isHeadless ifTrue:=20 + [FileStream stdout nextPutAll: err errorCode; cr; flush. - [FileStream stdout nextPutAll: err errorCode; lf; flush. Smalltalk snapshot: false andQuit: true ] ifFalse: [err pass] ]! Item was changed: ----- Method: Exception>>printVerboseOn: (in category '*system') ----- printVerboseOn: aStream=20 aStream nextPutAll: 'vvvvvvvvvvvvvvvvvv ' , self description , ' vvvvvvvvvvvvvvvv= vv' ; + cr ; - lf ; nextPutAll: 'The time is ', DateAndTime now asString ; + cr. - lf. "Allow applications to optionally print extra details without overriding a= base package." self printDetailsOn: aStream. aStream nextPutAll: self signalerContext longStack ; + cr ; - lf ; nextPutAll: '^^^^^^^^^^^^^^^^^^ ' , self description , ' ^^^^^^^^^^^^^^^^= ^^' ; + cr ; - lf ; flush! Item was changed: ----- Method: Preferences class>>debugLogTimestamp (in category 'standard q= ueries') ----- debugLogTimestamp ^ self valueOfFlag: #debugLogTimestamp + ifAbsent: [ false ]! - ifAbsent: [false]! Item was changed: ----- Method: SmalltalkImage>>run: (in category 'command line') ----- run: aBlock [ [ self patchSystem. (aBlock numArgs =3D 1 and: [ self arguments size > 1 ]) ifTrue: [ "Allow a large, variable number of arguments to be passed as an= Array to aBlock." aBlock value: self arguments ] ifFalse: [ aBlock valueWithEnoughArguments: self arguments ] ] on: SyntaxErrorNotification do: [ : err | FileStream stdout nextPutAll: err errorCode ; + cr; flush. - lf; flush. self isHeadless ifTrue: [ self snapshot: false andQuit: true ] ifFalse: [ err pass ] ] on: Error , ProvideAnswerNotification do: [ : err | err printVerboseOn: FileStream stderr. FileStream stderr flush. self isHeadless ifTrue: [ self snapshot: false andQuit: true ] ifFalse: [ err pass ] ] on: ProgressInitiationException do: [ : pie | "Don't want to log this Notification." pie defaultAction ] ] on: Notification , Warning do: [ : noti | FileStream stdout nextPutAll: DateAndTime now asString ; space ; nextPutAll: noti description ; + cr. - lf. noti resume ] ! --===============4414762244324339929==-- From commits@source.squeak.org Tue Feb 27 20:52:42 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: KernelTests-ct.455.mcz Date: Tue, 27 Feb 2024 20:52:36 +0000 Message-ID: <20240227205240.30A745826AA@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7400551187191327084==" --===============7400551187191327084== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of KernelTests to project The Trunk: http://source.squeak.org/trunk/KernelTests-ct.455.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: KernelTests-ct.455 Author: ct Time: 27 February 2024, 9:52:34.84305 pm UUID: f7671116-2057-d648-983a-a3754b1f80e1 Ancestors: KernelTests-ct.454 Fixes further slips in primitive simulation tests (silent temporary method di= ct changes, fix comment, add missing array brackets). =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against KernelTests-ct.454= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: ContextTest>>testPrimitive118: (in category 'tests - simulati= on') ----- testPrimitive118: primitiveBlock =20 | input1 input2 | { {#isNil. 62. {}}. "valid 0-arg primitive" {6. 9. {7}}. "valid unary primitive" {6. 62. {7}}. "failing primitive" {6. 'not a primitive'. {7}}. "invalid primitive" {6. 9. 'not an array'}. "invalid arguments" {#isNil. 62. {1}}. "too many arguments" {6. 9. {}}. "missing argument" =09 {6. 83. {#=3D. 6.0}}. "primitivePerform" {6. 83. {#isNil. 'excess arg'}}. "primitivePerform - too many arguments" {6. 84. {#=3D. {6.0}}}. "primitivePerformWithArgs" {6. 84. {#isNil. 'excess arg'}}. "primitivePerformWithArgs - invalid argu= ments" + {6. 100. {#=3D. {6.0}. Object}}. "primitivePerformInSuperclass" - {6. 100. {#=3D. 6.0. Object}}. "primitivePerformInSuperclass" {6. 100. {#isNil. {'excess arg'}. Object}}. "primitivePerformInSuperclass= - too many arguments" =09 {6. 118. {9. {7}}}. "primitiveDoPrimitiveWithArgs" {6. 118. {9. {7. 13}}}. "primitiveDoPrimitiveWithArgs - superfluous argum= ents" {6. 118. {118. {9. {7}}}}. "primitiveDoPrimitiveWithArgs - nested invocat= ion" {thisContext. 218. {Float32Array >> #sum. Float32Array withAll: {2.0. 3.0= }. {}}}. "primitiveDoNamedPrimitiveWithArgs" {thisContext. 218. {Float32Array >> #sum. Float32Array withAll: {2.0. 3.0= }. {4.0}}}. "primitiveDoNamedPrimitiveWithArgs - superfluous arguments" } do: [:args | | block | block :=3D [primitiveBlock valueWithArguments: args]. self assert: block value equals: (Context runSimulated: block)]. =09 self assert: (primitiveBlock value: (input1 :=3D {1. 2. 3}) value: 61 value: {= 2. 4}) equals: (Context runSimulated: [primitiveBlock value: (input2 :=3D {1. 2= . 3}) value: 61 value: {2. 4}]); assert: input1 equals: input2.! Item was changed: ----- Method: ContextTest>>testPrimitive189 (in category 'tests - simulatio= n') ----- testPrimitive189 + "Test simulation of primitive 189." - "Test simulation of primitive 118." =20 { [2 executeMethod: SmallInteger >> #even]. "valid 0-arg message" [2 with: 1 executeMethod: Integer >> #<<]. "valid unary message" [2 with: 3 with: 4 executeMethod: Integer >> #raisedTo:modulo:]. "valid b= inary message" [2 with: 1 executeMethod: Integer >> #even]. "too many arguments" [2 executeMethod: Integer >> #<<]. "missing argument" [2 with: 1 executeMethod: 'not a method']. "invalid method" [(2 with: 3 with: 4 executeMethod: (TestObjectForMethod new xxxMethod: th= isContext homeMethod)) allButFirst "OaM selector is undefined behavior"] "object as method" } do: [:block | self assert: (block on: Error do: [:ex | ex description]) equals: (Context runSimulated: [block on: Error do: [:ex | ex descriptio= n]])].! Item was changed: ----- Method: ContextTest>>testPrimitive83 (in category 'tests - simulation= ') ----- testPrimitive83 "Test simulation of primitive 83." =20 self flag: #bug. "Known bug: Primitive 83 SPORADICALLY does NOT fail in th= e OSVM for missing argument!!" =09 { [nil perform: #isNil]. "valid 0-arg message" [nil perform: #=3D with: true]. "valid unary message" [nil perform: #ifNil:ifNotNil: with: [2] with: [:x | x]]. "valid binary m= essage" [nil perform: #isNil with: 'excess arg']. "too many arguments" [nil perform: #=3D]. "missing argument" [nil perform: Object]. "invalid selector" [[(self class + addSelectorSilently: #plonk:with: withMethod: (TestObjectForMethod new x= xxMethod: thisContext homeMethod); - addSelector: #plonk:with: withMethod: (TestObjectForMethod new xxxMethod= : thisContext homeMethod); perform: #plonk:with: with: 2 with: 3) allButFirst "OaM selector is unde= fined behavior"] + ensure: [self class removeSelectorSilently: #plonk:with:]]. - ensure: [self class removeSelector: #plonk:with:]]. } do: [:block | self assert: (block on: Error do: [:ex | ex description]) equals: (Context runSimulated: [block on: Error do: [:ex | ex descriptio= n]])].! Item was changed: ----- Method: ContextTest>>testPrimitive84 (in category 'tests - simulation= ') ----- testPrimitive84 "Test simulation of primitive 84." =20 { {#isNil. {}}. "valid 0-arg message" {#=3D. {true}}. "valid unary message" {#ifNil:ifNotNil:. {[2]. [:x | x]}}. "valid binary message" {#isNil. 'not an array'}. "invalid arguments" {#isNil. {'excess arg'}}. "too many arguments" {#=3D. {}}. "missing argument" {Object. {}}. "invalid selector" {#in:. {[:it | [(self class + addSelectorSilently: #plonk:with: withMethod: (TestObjectForMethod new= xxxMethod: thisContext homeMethod); - addSelector: #plonk:with: withMethod: (TestObjectForMethod new xxxMeth= od: thisContext homeMethod); perform: #plonk:with: withArguments: #(2 3)) allButFirst "OaM selector= is undefined behavior"] + ensure: [self class removeSelectorSilently: #plonk:with:]]}}. - ensure: [self class removeSelector: #plonk:with:]]}}. } do: [:args | self assert: ([nil perform: args first withArguments: args second] on: Error = do: [:ex | ex description]) equals: (Context runSimulated: [[nil perform: args first withArguments: = args second] on: Error do: [:ex | ex description]])].! --===============7400551187191327084==-- From commits@source.squeak.org Tue Feb 27 22:03:11 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Graphics-nice.550.mcz Date: Tue, 27 Feb 2024 22:03:02 +0000 Message-ID: <20240227220309.884A35826AA@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7080524410797305984==" --===============7080524410797305984== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Nicolas Cellier uploaded a new version of Graphics to project The Trunk: http://source.squeak.org/trunk/Graphics-nice.550.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Graphics-nice.550 Author: nice Time: 7 February 2024, 11:08:47.366987 pm UUID: 9a845f0a-b60c-a740-93f9-d705b5b9b840 Ancestors: Graphics-mt.549 Provide a new Form hack of arbitrary width for bulk transfer of bytes. This may be used for example for reversing the endianness of a DoubleWordArra= y. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Graphics-mt.549 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: Form>>hackBits:width: (in category 'private') ----- + hackBits: bitThing width: anInteger + "This method provides an initialization so that BitBlt may be used, eg, to= =20 + copy ByteArrays and other non-pointer objects efficiently. + The resulting form looks anInteger wide, 8 bits deep, and height is adjust= ed to fit the bitThing size. + anInteger shall be a multiple of 4, because lines in a Form always fall on= a Word boundary. + If not, some dead bytes will remain unaccessible to the BitBlt operations = on each line. + That's also the case of trailing excess bytes" + width :=3D anInteger. + depth :=3D 8. + bitThing class isBits ifFalse: [self error: 'bitThing must be a non-pointe= r object']. + height :=3D bitThing basicSize * bitThing bytesPerBasicElement // (width += 3 // 4 * 4). + bits :=3D bitThing! --===============7080524410797305984==-- From commits@source.squeak.org Tue Feb 27 22:05:13 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Graphics-nice.551.mcz Date: Tue, 27 Feb 2024 22:05:04 +0000 Message-ID: <20240227220511.7846D58269B@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5386617609288491146==" --===============5386617609288491146== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Nicolas Cellier uploaded a new version of Graphics to project The Trunk: http://source.squeak.org/trunk/Graphics-nice.551.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Graphics-nice.551 Author: nice Time: 27 February 2024, 11:04:54.187486 pm UUID: 6687a9e4-2fa7-4981-8548-fa272b631eda Ancestors: Graphics-mt.550, Graphics-nice.550 Merge Graphics-mt.550 & Graphics-nice.550 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Graphics-mt.550 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: Form>>hackBits:width: (in category 'private') ----- + hackBits: bitThing width: anInteger + "This method provides an initialization so that BitBlt may be used, eg, to= =20 + copy ByteArrays and other non-pointer objects efficiently. + The resulting form looks anInteger wide, 8 bits deep, and height is adjust= ed to fit the bitThing size. + anInteger shall be a multiple of 4, because lines in a Form always fall on= a Word boundary. + If not, some dead bytes will remain unaccessible to the BitBlt operations = on each line. + That's also the case of trailing excess bytes" + width :=3D anInteger. + depth :=3D 8. + bitThing class isBits ifFalse: [self error: 'bitThing must be a non-pointe= r object']. + height :=3D bitThing basicSize * bitThing bytesPerBasicElement // (width += 3 // 4 * 4). + bits :=3D bitThing! --===============5386617609288491146==-- From commits@source.squeak.org Tue Feb 27 22:07:12 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Collections-nice.1059.mcz Date: Tue, 27 Feb 2024 22:07:03 +0000 Message-ID: <20240227220710.CD8065826C7@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3691863546159230810==" --===============3691863546159230810== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Nicolas Cellier uploaded a new version of Collections to project The Trunk: http://source.squeak.org/trunk/Collections-nice.1059.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Collections-nice.1059 Author: nice Time: 8 February 2024, 12:57:43.861987 am UUID: a61087ae-f9ac-4e43-89d1-837d3edb7493 Ancestors: Collections-mt.1058 Provide the ability to reverse the endianness of a RawBitsArray. Spur platfor= ms are all little-endian so far, so this is for the case when we would want t= o exchange such an array in a big-endian format. Example: | w | w :=3D WordArray with: 16r01020304. w reverseEndianness. w first hex =09 Also provide the ability to access the underlying bytes of any collection of = raw bits thru byteAt: and byteAt:put:, whatever the number of bytesPerBasicEl= ement. Examples: | w b | w :=3D WordArray with: 16r01020304. b :=3D w copy changeClassTo: ByteArray. 1 to: 4 do: [:index | self assert: (w byteAt: index) =3D (b byteAt: index)]. =09 | w b | w :=3D WordArray with: 16r01020304. b :=3D w copy changeClassTo: ByteArray. w byteAt: 3 put: 5. b byteAt: 3 put: 5. {w first hex. b} This might be usefull for low level operations, like simulating a VM for exam= ple. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Collections-mt.105= 8 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: RawBitsArray>>byteAt: (in category 'accessing') ----- + byteAt: anIndex=20 + "Access a byte of the receiver, considered as a raw sequence of bytes. + This is a memory efficient implementation of: + ((self copy changeClassTo: ByteArray) at: anIndex)" + | int mask stride index shift | + self class isBytes + ifTrue: [^ self basicAt: anIndex]. + mask :=3D 16rFF. + stride :=3D self bytesPerBasicElement. + index :=3D anIndex - 1 // stride + 1. + shift :=3D anIndex - 1 \\ stride * -8. + Smalltalk isLittleEndian ifFalse: [shift :=3D stride - 1 * 8 - shift]. + int :=3D self basicAt: index. + int :=3D int bitShift: shift. + int :=3D int bitAnd: mask. + ^int! Item was added: + ----- Method: RawBitsArray>>byteAt:put: (in category 'accessing') ----- + byteAt: anIndex put: aByte + "Modify a byte of the receiver, considered as a raw sequence of bytes. + This is a less scary implementation than: + ([:class | ((self changeClassTo: ByteArray) at: anIndex put: aByte) change= ClassTo: class] value: self class)" + | int stride index shift mask | + self class isBytes + ifTrue: [^ self basicAt: anIndex put: aByte]. + mask :=3D 16rFF. + stride :=3D self bytesPerBasicElement. + index :=3D anIndex - 1 // stride + 1. + shift :=3D anIndex - 1 \\ stride * 8. + Smalltalk isLittleEndian ifFalse: [shift :=3D stride - 1 * 8 - shift]. + int :=3D self basicAt: index. + int :=3D int bitClear: (mask bitShift: shift). + int :=3D int bitOr: (aByte bitShift: shift). + self basicAt: index put: int. + ^aByte! Item was added: + ----- Method: RawBitsArray>>reverseEndianness (in category 'converting') --= --- + reverseEndianness + "reverse the endianness for each element" + =09 + self class isBytes ifTrue: [^self]. + self class isWords ifTrue: [^self swapWords]. + self class isLongs ifTrue: [^self swapDoubleWords]. + self class isShorts ifTrue: [^self swapDoubleBytes]. + self error: 'this is not a collection of 1,2,4 or 8 bytes elements'! Item was added: + ----- Method: RawBitsArray>>swap16pairs (in category 'private') ----- + swap16pairs + "Swap every pair of double-bytes + Example: #[ 1 2 3 4 5 6 7 8 ] copy swap16pairs =3D> #[ 3 4 1 2 7 8 5 6] + Implementation notes: this is the same as swapHalves, except that swapHalv= es only work for WordArray" + =09 + | hack blt | + "The implementation is a hack, but fast for large ranges" + hack :=3D Form new hackBits: self. + blt :=3D (BitBlt toForm: hack) sourceForm: hack. + blt combinationRule: Form reverse. "XOR" + blt sourceY: 0; destY: 0; height: self byteSize//4; width: 2. + blt sourceX: 0; destX: 2; copyBits. "Exchange double-bytes 0 and 1" + blt sourceX: 2; destX: 0; copyBits. + blt sourceX: 0; destX: 2; copyBits.! Item was added: + ----- Method: RawBitsArray>>swap32pairs (in category 'private') ----- + swap32pairs + "Swap every pair of words + Example: #[ 1 2 3 4 5 6 7 8 ] copy swap32pairs =3D> #[ 5 6 7 8 1 2 3 4 ]" + =09 + | hack blt | + "The implementation is a hack, but fast for large ranges" + hack :=3D Form new hackBits: self width: 8. + blt :=3D (BitBlt toForm: hack) sourceForm: hack. + blt combinationRule: Form reverse. "XOR" + blt sourceY: 0; destY: 0; height: self byteSize//8; width: 4. + blt sourceX: 0; destX: 4; copyBits. "Exchange words 0 and 1" + blt sourceX: 4; destX: 0; copyBits. + blt sourceX: 0; destX: 4; copyBits.! Item was added: + ----- Method: RawBitsArray>>swap8pairs (in category 'private') ----- + swap8pairs + "Swap every pair of bytes + Example: #[ 1 2 3 4 5 6 ] copy swap8pairs =3D> #[ 2 1 4 3 6 5 ]" + =09 + | hack blt | + "The implementation is a hack, but fast for large ranges" + hack :=3D Form new hackBits: self. + blt :=3D (BitBlt toForm: hack) sourceForm: hack. + blt combinationRule: Form reverse. "XOR" + blt sourceY: 0; destY: 0; height: self byteSize//4; width: 1. + blt sourceX: 0; destX: 1; copyBits. "Exchange bytes 0 and 1" + blt sourceX: 1; destX: 0; copyBits. + blt sourceX: 0; destX: 1; copyBits. + blt sourceX: 2; destX: 3; copyBits. "Exchange bytes 2 and 3" + blt sourceX: 3; destX: 2; copyBits. + blt sourceX: 2; destX: 3; copyBits. + self byteSize\\4 >=3D 2 + ifTrue: + ["The lines in a From must fit on a Word boundary. + Handle the excess bytes" + | n tmp | + n :=3D self byteSize // 4 * 4. + tmp :=3D self byteAt: n + 1. + self byteAt: n + 1 put: (self byteAt: n + 2). + self byteAt: n + 2 put: tmp.]! Item was added: + ----- Method: RawBitsArray>>swapDoubleBytes (in category 'private') ----- + swapDoubleBytes + "Perform a bigEndian/littleEndian byte reversal of my double bytes. + Assume that our byte size is a multiple of souble byte size (2) + If it's not the case, trailing bytes would be left unchanged" + =09 + self swap8pairs! Item was added: + ----- Method: RawBitsArray>>swapDoubleWords (in category 'private') ----- + swapDoubleWords + "Perform a bigEndian/littleEndian byte reversal of my double words. + Assume that our byte size is a multiple of double word size (8) + If it's not the case, 4 trailing bytes might be altered" + =09 + self swap32pairs. "#[1 2 3 4 5 6 7 8] copy swap32pairs =3D> #[5 6 7 8 1 2 = 3 4]" + self swapWords "#[5 6 7 8 1 2 3 4] copy swapWords =3D> #[8 7 6 5 4 3 2 1]"! Item was added: + ----- Method: RawBitsArray>>swapWords (in category 'private') ----- + swapWords + "Perform a bigEndian/littleEndian byte reversal of my words. + Assume that our byte size is a multiple of word size (4) + If it's not the case, trailing bytes will remain unchanged" + =09 + | hack blt | + "The implementation is a hack, but fast for large ranges" + hack :=3D Form new hackBits: self. + blt :=3D (BitBlt toForm: hack) sourceForm: hack. + blt combinationRule: Form reverse. "XOR" + blt sourceY: 0; destY: 0; height: self byteSize//4; width: 1. + blt sourceX: 0; destX: 3; copyBits. "Exchange bytes 0 and 3" + blt sourceX: 3; destX: 0; copyBits. + blt sourceX: 0; destX: 3; copyBits. + blt sourceX: 2; destX: 1; copyBits. "Exchange bytes 1 and 2" + blt sourceX: 1; destX: 2; copyBits. + blt sourceX: 2; destX: 1; copyBits.! --===============3691863546159230810==-- From commits@source.squeak.org Tue Feb 27 22:08:29 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: Collections-nice.1060.mcz Date: Tue, 27 Feb 2024 22:08:21 +0000 Message-ID: <20240227220827.AE73E583C22@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2081844918380326837==" --===============2081844918380326837== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Nicolas Cellier uploaded a new version of Collections to project The Trunk: http://source.squeak.org/trunk/Collections-nice.1060.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: Collections-nice.1060 Author: nice Time: 27 February 2024, 11:08:13.826491 pm UUID: 335742d4-2ba3-4c02-8019-86ff466a5772 Ancestors: Collections-cmm.1059, Collections-nice.1059 Merge Collections-cmm.1059, Collections-nice.1059 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against Collections-cmm.10= 59 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was added: + ----- Method: RawBitsArray>>byteAt: (in category 'accessing') ----- + byteAt: anIndex=20 + "Access a byte of the receiver, considered as a raw sequence of bytes. + This is a memory efficient implementation of: + ((self copy changeClassTo: ByteArray) at: anIndex)" + | int mask stride index shift | + self class isBytes + ifTrue: [^ self basicAt: anIndex]. + mask :=3D 16rFF. + stride :=3D self bytesPerBasicElement. + index :=3D anIndex - 1 // stride + 1. + shift :=3D anIndex - 1 \\ stride * -8. + Smalltalk isLittleEndian ifFalse: [shift :=3D stride - 1 * 8 - shift]. + int :=3D self basicAt: index. + int :=3D int bitShift: shift. + int :=3D int bitAnd: mask. + ^int! Item was added: + ----- Method: RawBitsArray>>byteAt:put: (in category 'accessing') ----- + byteAt: anIndex put: aByte + "Modify a byte of the receiver, considered as a raw sequence of bytes. + This is a less scary implementation than: + ([:class | ((self changeClassTo: ByteArray) at: anIndex put: aByte) change= ClassTo: class] value: self class)" + | int stride index shift mask | + self class isBytes + ifTrue: [^ self basicAt: anIndex put: aByte]. + mask :=3D 16rFF. + stride :=3D self bytesPerBasicElement. + index :=3D anIndex - 1 // stride + 1. + shift :=3D anIndex - 1 \\ stride * 8. + Smalltalk isLittleEndian ifFalse: [shift :=3D stride - 1 * 8 - shift]. + int :=3D self basicAt: index. + int :=3D int bitClear: (mask bitShift: shift). + int :=3D int bitOr: (aByte bitShift: shift). + self basicAt: index put: int. + ^aByte! Item was added: + ----- Method: RawBitsArray>>reverseEndianness (in category 'converting') --= --- + reverseEndianness + "reverse the endianness for each element" + =09 + self class isBytes ifTrue: [^self]. + self class isWords ifTrue: [^self swapWords]. + self class isLongs ifTrue: [^self swapDoubleWords]. + self class isShorts ifTrue: [^self swapDoubleBytes]. + self error: 'this is not a collection of 1,2,4 or 8 bytes elements'! Item was added: + ----- Method: RawBitsArray>>swap16pairs (in category 'private') ----- + swap16pairs + "Swap every pair of double-bytes + Example: #[ 1 2 3 4 5 6 7 8 ] copy swap16pairs =3D> #[ 3 4 1 2 7 8 5 6] + Implementation notes: this is the same as swapHalves, except that swapHalv= es only work for WordArray" + =09 + | hack blt | + "The implementation is a hack, but fast for large ranges" + hack :=3D Form new hackBits: self. + blt :=3D (BitBlt toForm: hack) sourceForm: hack. + blt combinationRule: Form reverse. "XOR" + blt sourceY: 0; destY: 0; height: self byteSize//4; width: 2. + blt sourceX: 0; destX: 2; copyBits. "Exchange double-bytes 0 and 1" + blt sourceX: 2; destX: 0; copyBits. + blt sourceX: 0; destX: 2; copyBits.! Item was added: + ----- Method: RawBitsArray>>swap32pairs (in category 'private') ----- + swap32pairs + "Swap every pair of words + Example: #[ 1 2 3 4 5 6 7 8 ] copy swap32pairs =3D> #[ 5 6 7 8 1 2 3 4 ]" + =09 + | hack blt | + "The implementation is a hack, but fast for large ranges" + hack :=3D Form new hackBits: self width: 8. + blt :=3D (BitBlt toForm: hack) sourceForm: hack. + blt combinationRule: Form reverse. "XOR" + blt sourceY: 0; destY: 0; height: self byteSize//8; width: 4. + blt sourceX: 0; destX: 4; copyBits. "Exchange words 0 and 1" + blt sourceX: 4; destX: 0; copyBits. + blt sourceX: 0; destX: 4; copyBits.! Item was added: + ----- Method: RawBitsArray>>swap8pairs (in category 'private') ----- + swap8pairs + "Swap every pair of bytes + Example: #[ 1 2 3 4 5 6 ] copy swap8pairs =3D> #[ 2 1 4 3 6 5 ]" + =09 + | hack blt | + "The implementation is a hack, but fast for large ranges" + hack :=3D Form new hackBits: self. + blt :=3D (BitBlt toForm: hack) sourceForm: hack. + blt combinationRule: Form reverse. "XOR" + blt sourceY: 0; destY: 0; height: self byteSize//4; width: 1. + blt sourceX: 0; destX: 1; copyBits. "Exchange bytes 0 and 1" + blt sourceX: 1; destX: 0; copyBits. + blt sourceX: 0; destX: 1; copyBits. + blt sourceX: 2; destX: 3; copyBits. "Exchange bytes 2 and 3" + blt sourceX: 3; destX: 2; copyBits. + blt sourceX: 2; destX: 3; copyBits. + self byteSize\\4 >=3D 2 + ifTrue: + ["The lines in a From must fit on a Word boundary. + Handle the excess bytes" + | n tmp | + n :=3D self byteSize // 4 * 4. + tmp :=3D self byteAt: n + 1. + self byteAt: n + 1 put: (self byteAt: n + 2). + self byteAt: n + 2 put: tmp.]! Item was added: + ----- Method: RawBitsArray>>swapDoubleBytes (in category 'private') ----- + swapDoubleBytes + "Perform a bigEndian/littleEndian byte reversal of my double bytes. + Assume that our byte size is a multiple of souble byte size (2) + If it's not the case, trailing bytes would be left unchanged" + =09 + self swap8pairs! Item was added: + ----- Method: RawBitsArray>>swapDoubleWords (in category 'private') ----- + swapDoubleWords + "Perform a bigEndian/littleEndian byte reversal of my double words. + Assume that our byte size is a multiple of double word size (8) + If it's not the case, 4 trailing bytes might be altered" + =09 + self swap32pairs. "#[1 2 3 4 5 6 7 8] copy swap32pairs =3D> #[5 6 7 8 1 2 = 3 4]" + self swapWords "#[5 6 7 8 1 2 3 4] copy swapWords =3D> #[8 7 6 5 4 3 2 1]"! Item was added: + ----- Method: RawBitsArray>>swapWords (in category 'private') ----- + swapWords + "Perform a bigEndian/littleEndian byte reversal of my words. + Assume that our byte size is a multiple of word size (4) + If it's not the case, trailing bytes will remain unchanged" + =09 + | hack blt | + "The implementation is a hack, but fast for large ranges" + hack :=3D Form new hackBits: self. + blt :=3D (BitBlt toForm: hack) sourceForm: hack. + blt combinationRule: Form reverse. "XOR" + blt sourceY: 0; destY: 0; height: self byteSize//4; width: 1. + blt sourceX: 0; destX: 3; copyBits. "Exchange bytes 0 and 3" + blt sourceX: 3; destX: 0; copyBits. + blt sourceX: 0; destX: 3; copyBits. + blt sourceX: 2; destX: 1; copyBits. "Exchange bytes 1 and 2" + blt sourceX: 1; destX: 2; copyBits. + blt sourceX: 2; destX: 1; copyBits.! --===============2081844918380326837==-- From commits@source.squeak.org Wed Feb 28 00:01:01 2024 From: commits@source.squeak.org To: packages@lists.squeakfoundation.org Subject: [Pkg] The Trunk: KernelTests-ct.456.mcz Date: Wed, 28 Feb 2024 00:00:52 +0000 Message-ID: <20240228000058.2B27A583C21@mail.squeak.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3398422502159900581==" --===============3398422502159900581== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Christoph Thiede uploaded a new version of KernelTests to project The Trunk: http://source.squeak.org/trunk/KernelTests-ct.456.mcz =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Summary =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Name: KernelTests-ct.456 Author: ct Time: 28 February 2024, 1:00:51.34405 am UUID: 18cac4fa-153a-1646-9b47-98fb20a52258 Ancestors: KernelTests-ct.455 Actually fixes OaM fixture for primitive 83/primitive 84 and adds the same fi= xture to testPrimitive100. Sorry for the noise. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Diff against KernelTests-ct.455= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Item was changed: ----- Method: ContextTest>>testPrimitive100 (in category 'tests - simulatio= n') ----- testPrimitive100 "Test simulation of primitive 100." =20 { {#isNil. {}. Object}. "valid 0-arg message" {#=3D. {true}. UndefinedObject}. "valid unary message" {#ifNil:ifNotNil:. {[2]. [:x | x]}. Object}. "valid binary message" {{}. #=3D. {true}. SequenceableCollection}. "mirror primitive" {'not a selector'. {}. Object}. "invalid selector" {#isNil. 'not an array'. Object}. "invalid arguments" {#isNil. {'excess arg'}. Object}. "too many arguments" {#=3D. {}. UndefinedObject}. "missing argument" {#isNil. {}. 'not a class'}. "invalid lookupClass" {#isNil. {}. Boolean}. "lookupClass not in inheritance chain" + {#in:. + {[:it | + [self class addSelectorSilently: #plonk:with: withMethod: (TestObjectFo= rMethod new xxxMethod: thisContext homeMethod). + (self perform: #plonk:with: withArguments: #(2 3)) allButFirst "OaM sel= ector is undefined behavior"] + ensure: [self class removeSelectorSilently: #plonk:with:]]}. + UndefinedObject}. } do: [:args | | block | block :=3D [[nil perform: args first withArguments: args second inSuperclass: args third] on: Error do: [:ex | ex description]]. self assert: block value equals: (Context runSimulated: block). =09 block :=3D [[thisContext object: nil perform: args first withArguments: args second inClass: args third] on: Error do: [:ex | ex description]]. self assert: block value equals: (Context runSimulated: block)].! Item was changed: ----- Method: ContextTest>>testPrimitive83 (in category 'tests - simulation= ') ----- testPrimitive83 "Test simulation of primitive 83." =20 self flag: #bug. "Known bug: Primitive 83 SPORADICALLY does NOT fail in th= e OSVM for missing argument!!" =09 { [nil perform: #isNil]. "valid 0-arg message" [nil perform: #=3D with: true]. "valid unary message" [nil perform: #ifNil:ifNotNil: with: [2] with: [:x | x]]. "valid binary m= essage" [nil perform: #isNil with: 'excess arg']. "too many arguments" [nil perform: #=3D]. "missing argument" [nil perform: Object]. "invalid selector" + [[self class addSelectorSilently: #plonk:with: withMethod: (TestObjectFor= Method new xxxMethod: thisContext homeMethod). + (self perform: #plonk:with: with: 2 with: 3) allButFirst "OaM selector is= undefined behavior"] + ensure: [self class removeSelectorSilently: #plonk:with:]]. - [[(self class - addSelectorSilently: #plonk:with: withMethod: (TestObjectForMethod new x= xxMethod: thisContext homeMethod); - perform: #plonk:with: with: 2 with: 3) allButFirst "OaM selector is unde= fined behavior"] - ensure: [self class removeSelectorSilently: #plonk:with:]]. } do: [:block | self assert: (block on: Error do: [:ex | ex description]) equals: (Context runSimulated: [block on: Error do: [:ex | ex descriptio= n]])].! Item was changed: ----- Method: ContextTest>>testPrimitive84 (in category 'tests - simulation= ') ----- testPrimitive84 "Test simulation of primitive 84." =20 { {#isNil. {}}. "valid 0-arg message" {#=3D. {true}}. "valid unary message" {#ifNil:ifNotNil:. {[2]. [:x | x]}}. "valid binary message" {#isNil. 'not an array'}. "invalid arguments" {#isNil. {'excess arg'}}. "too many arguments" {#=3D. {}}. "missing argument" {Object. {}}. "invalid selector" {#in:. {[:it | + [self class addSelectorSilently: #plonk:with: withMethod: (TestObjectFo= rMethod new xxxMethod: thisContext homeMethod). + (self perform: #plonk:with: withArguments: #(2 3)) allButFirst "OaM sel= ector is undefined behavior"] + ensure: [self class removeSelectorSilently: #plonk:with:]]}}. - [(self class - addSelectorSilently: #plonk:with: withMethod: (TestObjectForMethod new= xxxMethod: thisContext homeMethod); - perform: #plonk:with: withArguments: #(2 3)) allButFirst "OaM selector= is undefined behavior"] - ensure: [self class removeSelectorSilently: #plonk:with:]]}}. } do: [:args | self assert: ([nil perform: args first withArguments: args second] on: Error = do: [:ex | ex description]) equals: (Context runSimulated: [[nil perform: args first withArguments: = args second] on: Error do: [:ex | ex description]])].! --===============3398422502159900581==--