Author: Anton Gulenko <[email protected]>
Branch: storage
Changeset: r926:64d91d5de341
Date: 2014-07-21 18:35 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/64d91d5de341/
Log: Fixed WeakMessageSend class. Errors at startup are gone, and print-
its in workspace work!!
diff --git a/images/Squeak4.5-noBitBlt.changes
b/images/Squeak4.5-noBitBlt.changes
--- a/images/Squeak4.5-noBitBlt.changes
+++ b/images/Squeak4.5-noBitBlt.changes
@@ -12620,4 +12620,15 @@
1 to: self splayTreeSize do: [:i |
self insertNewNode.
- ]! !
----SNAPSHOT----{15 July 2014 . 6:10:56 pm} Squeak4.5-noBitBlt.image
priorSource: 15894330!
\ No newline at end of file
+ ]! !
----SNAPSHOT----{15 July 2014 . 6:10:56 pm} Squeak4.5-noBitBlt.image
priorSource: 15894330!
+
+----QUIT/NOSAVE----{21 July 2014 . 4:18:39 pm} Squeak4.5-noBitBlt.image
priorSource: 15894825!
----STARTUP----{21 July 2014 . 6:19:06 pm} as
C:\Dev\lang-smalltalk\images\Squeak4.5-noBitBlt.image!
!WeakMessageSend methodsFor: 'private' stamp: 'ag 7/21/2014 18:20' prior:
34321504!
withEnsuredReceiverAndArgumentsDo: aBlock otherwise: altBlock
"Grab real references to receiver and arguments. If they still exist,
evaluate aBlock."
"Return if my receiver has gone away"
| r a |
r := self receiver.
r ifNil: [ ^altBlock value ].
"Make sure that my arguments haven't gone away"
arguments ifNil: [ ^ altBlock value ].
a := Array withAll: arguments.
a with: shouldBeNil do: [ :arg :flag |
arg ifNil: [ flag ifFalse: [ ^altBlock value ]]
].
^aBlock value: r value: a! !
----QUIT----{21 July 2014 . 6:20:43 pm} Squeak4.5-noBitBlt.image priorSource:
15894825!
+
+----QUIT/NOSAVE----{21 July 2014 . 4:21:36 pm} Squeak4.5-noBitBlt.image
priorSource: 15895702!
----STARTUP----{21 July 2014 . 6:21:54 pm} as
C:\Dev\lang-smalltalk\images\Squeak4.5-noBitBlt.image!
!WeakMessageSend methodsFor: 'comparing' stamp: 'ag 7/21/2014 18:22' prior:
33144463!
= anObject
"Compare equal to equivalent MessageSend"
^ anObject isMessageSend
and: [self receiver == anObject receiver
and: [selector == anObject selector
and: [(Array withAll: self arguments) = (Array withAll:
anObject arguments)]]]
! !
!WeakMessageSend methodsFor: 'private' stamp: 'ag 7/21/2014 18:23' prior:
49449636!
withEnsuredReceiverAndArgumentsDo: aBlock otherwise: altBlock
"Grab real references to receiver and arguments. If they still exist,
evaluate aBlock."
"Return if my receiver has gone away"
| r a |
r := self receiver.
r ifNil: [ ^altBlock value ].
"Make sure that my arguments haven't gone away"
a := Array withAll: self arguments.
a with: shouldBeNil do: [ :arg :flag |
arg ifNil: [ flag ifFalse: [ ^altBlock value ]]
].
^aBlock value: r value: a! !
----QUIT----{21 July 2014 . 6:23:49 pm} Squeak4.5-noBitBlt.image priorSource:
15895702!
----STARTUP----{21 July 2014 . 6:31:05 pm} as
C:\Dev\lang-smalltalk\images\Squeak4.5-noBitBlt.image!
!WeakMessageSend methodsFor: 'accessing' stamp: 'ag 7/21/2014 18:31'!
shouldBeNil
^ shouldBeNil ifNil: [ Array new ]! !
!WeakMessageSend methodsFor: 'private' stamp: 'ag 7/21/2014 18:31' prior:
33148869!
isAnyArgumentGarbage
"Make sure that my arguments haven't gone away"
arguments ifNotNil: [
arguments with: self shouldBeNil do: [ :arg :flag |
(flag not and: [arg isNil])
ifTrue: [^true]
]
].
^false
! !
!WeakMessageSend methodsFor: 'private' stamp: 'ag 7/21/2014 18:31' prior:
49450841!
withEnsuredReceiverAndArgumentsDo: aBlock otherwise: altBlock
"Grab real references to receiver and arguments. If they still exist,
evaluate aBlock."
"Return if my receiver has gone away"
| r a |
r := self receiver.
r ifNil: [ ^altBlock value ].
"Make sure that my arguments haven't gone away"
a := Array withAll: self arguments.
a with: self shouldBeNil do: [ :arg :flag |
arg ifNil: [ flag ifFalse: [ ^altBlock value ]]
].
^aBlock value: r value: a! !
!WeakMessageSend methodsFor: 'private' stamp: 'ag 7/21/2014 18:32' prior:
34360552!
withEnsuredReceiverAndArgumentsDo: aBlock withEnoughArguments: anArray
otherwise: altBlock
"call the selector with enough arguments from arguments and anArray"
| r selfArgs enoughArgs |
r := self receiver.
r ifNil: [ ^altBlock value ].
selfArgs := self arguments.
selfArgs with: self shouldBeNil do: [ :arg :flag |
arg ifNil: [ flag ifFalse: [ ^altBlock value ]]
].
enoughArgs := Array new: selector numArgs.
enoughArgs replaceFrom: 1
to: ( selfArgs size min: enoughArgs size)
with: selfArgs
startingAt: 1.
enoughArgs size > selfArgs size ifTrue: [
enoughArgs replaceFrom: selfArgs size + 1
to: (selfArgs size + anArray size min: enoughArgs size)
with: anArray
startingAt: 1.
].
^aBlock value: r value: enoughArgs! !
----QUIT----{21 July 2014 . 6:32:32 pm} Squeak4.5-noBitBlt.image priorSource:
15896872!
+
+----STARTUP----{21 July 2014 . 4:32:52 pm} as
C:\Dev\lang-smalltalk\images\Squeak4.5-noBitBlt.image!
+
+
+1+1!
+
+----QUIT/NOSAVE----{21 July 2014 . 4:33:15 pm} Squeak4.5-noBitBlt.image
priorSource: 15898877!
\ No newline at end of file
diff --git a/images/Squeak4.5-noBitBlt.image b/images/Squeak4.5-noBitBlt.image
index
ed92c78c940799d91bb94a8ed8527076db6816c7..00843c2c83f9c11e5dcfa3b9927bd415d0a22cd8
GIT binary patch
[cut]
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit