The Trunk: Collections-mt.908.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-mt.908.mcz

commits-2
Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.908.mcz

==================== Summary ====================

Name: Collections-mt.908
Author: mt
Time: 14 September 2020, 6:27:49.862914 pm
UUID: abfcedd9-2516-7c49-b6e9-714619e50986
Ancestors: Collections-eem.907

Fixes some error messages regarding #become(Forward):.

=============== Diff against Collections-eem.907 ===============

Item was changed:
  ----- Method: Array>>elementsExchangeIdentityWith: (in category 'converting') -----
  elementsExchangeIdentityWith: otherArray
  "This primitive performs a bulk mutation, causing all pointers to the elements of the
  receiver to be replaced by pointers to the corresponding elements of otherArray.
  At the same time, all pointers to the elements of otherArray are replaced by
  pointers to the corresponding elements of this array.  The identityHashes remain
  with the pointers rather than with the objects so that objects in hashed structures
  should still be properly indexed after the mutation."
 
  <primitive: 128 error: ec>
  ec == #'no modification' ifTrue:
  [^self modificationForbiddenFor: otherArray becomeSelector: #elementsExchangeIdentityWith:].
  ec == #'bad receiver' ifTrue:
  [^self error: 'receiver must be of class Array'].
  ec == #'bad argument' ifTrue:
  [^self error: (otherArray class == Array
+ ifFalse: ['arg must be of class Array']
+ ifTrue: ['receiver and argument must have the same size'])].
- ifTrue: ['arg must be of class Array']
- ifFalse: ['receiver and argument must have the same size'])].
  ec == #'inappropriate operation' ifTrue:
  [^self error: 'can''t become immediates such as SmallIntegers or Characters'].
  ec == #'object is pinned' ifTrue:
  [^self error: 'can''t become pinned objects'].
  ec == #'insufficient object memory' ifTrue:
  [| maxRequired |
  "In Spur, two-way become may involve making each pair of objects into a forwarder into a copy of the other.
  So if become fails with #'insufficient object memory', garbage collect, and if necessary, grow memory."
  maxRequired := (self detectSum: [:obj | obj class byteSizeOfInstanceOfSize: obj basicSize])
  + (otherArray detectSum: [:obj | obj class byteSizeOfInstanceOfSize: obj basicSize]).
  (Smalltalk garbageCollectMost < maxRequired
   and: [Smalltalk garbageCollect < maxRequired]) ifTrue:
  [Smalltalk growMemoryByAtLeast: maxRequired].
  ^self elementsExchangeIdentityWith: otherArray].
  self primitiveFailed!

Item was changed:
  ----- Method: Array>>elementsForwardIdentityAndHashTo: (in category 'converting') -----
  elementsForwardIdentityAndHashTo: otherArray
  "This primitive performs a bulk mutation, causing all pointers to the elements of the
  receiver to be replaced by pointers to the corresponding elements of otherArray.
  The identityHashes remain with the pointers rather than with the objects so that
  the objects in this array should still be properly indexed in any existing hashed
  structures after the mutation."
  <primitive: 72 error: ec>
  ec == #'no modification' ifTrue:
  [^self modificationForbiddenFor: otherArray becomeSelector: #elementsForwardIdentityAndHashTo:].
  ec == #'bad receiver' ifTrue:
  [^self error: 'receiver must be of class Array'].
  ec == #'bad argument' ifTrue:
  [^self error: (otherArray class == Array
+ ifFalse: ['arg must be of class Array']
+ ifTrue: ['receiver and argument must have the same size'])].
- ifTrue: ['arg must be of class Array']
- ifFalse: ['receiver and argument must have the same size'])].
  ec == #'inappropriate operation' ifTrue:
  [^self error: 'can''t become immediates such as SmallIntegers or Characters'].
  ec == #'object is pinned' ifTrue:
  [^self error: 'can''t become pinned objects'].
  ec == #'insufficient object memory' ifTrue:
  [self error: 'The virtual machine is out-of-date.  Please upgrade.'].
  self primitiveFailed!

Item was changed:
  ----- Method: Array>>elementsForwardIdentityTo: (in category 'converting') -----
  elementsForwardIdentityTo: otherArray
  "This primitive performs a bulk mutation, causing all pointers to the elements of the
  receiver to be replaced by pointers to the corresponding elements of otherArray.
  The identityHashes are not copied to the target objects so that the objects in otherArray
  should still be properly indexed in any existing hashed structures after the mutation."
  <primitive: 248 error: ec>
  ec == #'no modification' ifTrue:
  [^self modificationForbiddenFor: otherArray becomeSelector: #elementsForwardIdentityTo:].
  ec == #'bad receiver' ifTrue:
  [^self error: 'receiver must be of class Array'].
  ec == #'bad argument' ifTrue:
  [^self error: (otherArray class == Array
+ ifFalse: ['arg must be of class Array']
+ ifTrue: ['receiver and argument must have the same size'])].
- ifTrue: ['arg must be of class Array']
- ifFalse: ['receiver and argument must have the same size'])].
  ec == #'inappropriate operation' ifTrue:
  [^self error: 'can''t become immediates such as SmallIntegers or Characters'].
  ec == #'object is pinned' ifTrue:
  [^self error: 'can''t become pinned objects'].
  ec == #'insufficient object memory' ifTrue:
  [self error: 'The virtual machine is out-of-date.  Please upgrade.'].
  self primitiveFailed!

Item was changed:
  ----- Method: Array>>elementsForwardIdentityTo:copyHash: (in category 'converting') -----
  elementsForwardIdentityTo: otherArray copyHash: copyHash
  "This primitive performs a bulk mutation, causing all pointers to the elements of the
  receiver to be replaced by pointers to the corresponding elements of otherArray.
  If copyHash is true, the identityHashes remain with the pointers rather than with the
  objects so that the objects in the receiver should still be properly indexed in any
  existing hashed structures after the mutation.  If copyHash is false, then the hashes
  of the objects in otherArray remain unchanged.  If you know what you're doing this
  may indeed be what you want."
  <primitive: 249 error: ec>
  ec == #'no modification' ifTrue:
  [^self modificationForbiddenFor: otherArray argument: copyHash becomeSelector: #elementsForwardIdentityTo:copyHash:].
  ec == #'bad receiver' ifTrue:
  [^self error: 'receiver must be of class Array'].
  ec == #'bad argument' ifTrue:
  [^self error: (otherArray class == Array
+ ifFalse: ['arg must be of class Array']
+ ifTrue: ['receiver and argument must have the same size'])].
- ifTrue: ['arg must be of class Array']
- ifFalse: ['receiver and argument must have the same size'])].
  ec == #'inappropriate operation' ifTrue:
  [^self error: 'can''t become immediates such as SmallIntegers or Characters'].
  ec == #'object is pinned' ifTrue:
  [^self error: 'can''t become pinned objects'].
  self primitiveFailed!