Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.869.mcz
==================== Summary ====================
Name: Kernel-eem.869
Author: eem
Time: 2 September 2014, 2:28:08.442 pm
UUID: 69beb9e8-c62a-41d3-9d0f-e2c265530789
Ancestors: Kernel-mt.868
Fix a bug and an issue with ContextPart>>quickSend:to:with:super:.
First, the lookup class for a normal send should be derived
from the rcvr argument, not from the context's receiver.
Second, the existing code assumed the SqueakV3/Smalltalk-80
bytecode set.
Requires at least Compiler-eem.288.
=============== Diff against Kernel-mt.868 ===============
Item was changed:
----- Method: ContextPart>>quickSend:to:with:super: (in category 'controlling') -----
+ quickSend: selector to: rcvr with: arguments super: superFlag
- quickSend: selector to: receiver with: arguments super: superFlag
"Send the given selector with arguments in an environment which closely resembles
the non-simulating environment, with an interjected unwind-protected block to catch
nonlocal returns. Attention: don't get lost!! This beautiful method is due to
Hans-Martin Mosner. Eliot Miranda merely added the mirror primitive code."
| oldSender contextToReturnTo result lookupClass |
contextToReturnTo := self.
lookupClass := superFlag
ifTrue: [self method methodClassAssociation value superclass]
+ ifFalse: [self objectClass: rcvr].
- ifFalse: [self objectClass: self receiver].
[oldSender := thisContext sender swapSender: self.
+ result := self object: rcvr perform: selector withArguments: arguments inClass: lookupClass.
+ thisContext sender swapSender: oldSender] ifCurtailed:
- result := self object: receiver perform: selector withArguments: arguments inClass: lookupClass.
- thisContext sender swapSender: oldSender] ifCurtailed:
[contextToReturnTo := thisContext sender receiver. "The block context returning nonlocally"
+ contextToReturnTo pc: contextToReturnTo previousPc. "skip to front of return bytecode causing this unwind"
+ contextToReturnTo willReturnTopFromMethod ifTrue:
- contextToReturnTo jump: -1. "skip to front of return bytecode causing this unwind"
- contextToReturnTo nextByte = 16r7C ifTrue:
"If it was a returnTop, push the value to be returned.
Otherwise the value is implicit in the bytecode"
[contextToReturnTo push: (thisContext sender tempAt: 1)].
thisContext swapSender: thisContext home sender. "Make this block return to the method's sender"
contextToReturnTo].
contextToReturnTo push: result.
^contextToReturnTo!
Item was added:
+ ----- Method: InstructionStream>>willReturnTopFromMethod (in category 'testing') -----
+ willReturnTopFromMethod
+ "Answer whether the next bytecode is a return stack top from method."
+ | method |
+ method := self method.
+ ^method encoderClass isReturnTopFromMethodAt: pc in: method!
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.869.mcz
==================== Summary ====================
Name: Kernel-eem.869
Author: eem
Time: 2 September 2014, 2:28:08.442 pm
UUID: 69beb9e8-c62a-41d3-9d0f-e2c265530789
Ancestors: Kernel-mt.868
Fix a bug and an issue with ContextPart>>quickSend:to:with:super:.
First, the lookup class for a normal send should be derived
from the rcvr argument, not from the context's receiver.
Second, the existing code assumed the SqueakV3/Smalltalk-80
bytecode set.
Requires at least Compiler-eem.288.
=============== Diff against Kernel-mt.868 ===============
Item was changed:
----- Method: ContextPart>>quickSend:to:with:super: (in category 'controlling') -----
+ quickSend: selector to: rcvr with: arguments super: superFlag
- quickSend: selector to: receiver with: arguments super: superFlag
"Send the given selector with arguments in an environment which closely resembles
the non-simulating environment, with an interjected unwind-protected block to catch
nonlocal returns. Attention: don't get lost!! This beautiful method is due to
Hans-Martin Mosner. Eliot Miranda merely added the mirror primitive code."
| oldSender contextToReturnTo result lookupClass |
contextToReturnTo := self.
lookupClass := superFlag
ifTrue: [self method methodClassAssociation value superclass]
+ ifFalse: [self objectClass: rcvr].
- ifFalse: [self objectClass: self receiver].
[oldSender := thisContext sender swapSender: self.
+ result := self object: rcvr perform: selector withArguments: arguments inClass: lookupClass.
+ thisContext sender swapSender: oldSender] ifCurtailed:
- result := self object: receiver perform: selector withArguments: arguments inClass: lookupClass.
- thisContext sender swapSender: oldSender] ifCurtailed:
[contextToReturnTo := thisContext sender receiver. "The block context returning nonlocally"
+ contextToReturnTo pc: contextToReturnTo previousPc. "skip to front of return bytecode causing this unwind"
+ contextToReturnTo willReturnTopFromMethod ifTrue:
- contextToReturnTo jump: -1. "skip to front of return bytecode causing this unwind"
- contextToReturnTo nextByte = 16r7C ifTrue:
"If it was a returnTop, push the value to be returned.
Otherwise the value is implicit in the bytecode"
[contextToReturnTo push: (thisContext sender tempAt: 1)].
thisContext swapSender: thisContext home sender. "Make this block return to the method's sender"
contextToReturnTo].
contextToReturnTo push: result.
^contextToReturnTo!
Item was added:
+ ----- Method: InstructionStream>>willReturnTopFromMethod (in category 'testing') -----
+ willReturnTopFromMethod
+ "Answer whether the next bytecode is a return stack top from method."
+ | method |
+ method := self method.
+ ^method encoderClass isReturnTopFromMethodAt: pc in: method!
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.869.mcz
==================== Summary ====================
Name: Kernel-eem.869
Author: eem
Time: 2 September 2014, 2:28:08.442 pm
UUID: 69beb9e8-c62a-41d3-9d0f-e2c265530789
Ancestors: Kernel-mt.868
Fix a bug and an issue with ContextPart>>quickSend:to:with:super:.
First, the lookup class for a normal send should be derived
from the rcvr argument, not from the context's receiver.
Second, the existing code assumed the SqueakV3/Smalltalk-80
bytecode set.
Requires at least Compiler-eem.288.
=============== Diff against Kernel-mt.868 ===============
Item was changed:
----- Method: ContextPart>>quickSend:to:with:super: (in category 'controlling') -----
+ quickSend: selector to: rcvr with: arguments super: superFlag
- quickSend: selector to: receiver with: arguments super: superFlag
"Send the given selector with arguments in an environment which closely resembles
the non-simulating environment, with an interjected unwind-protected block to catch
nonlocal returns. Attention: don't get lost!! This beautiful method is due to
Hans-Martin Mosner. Eliot Miranda merely added the mirror primitive code."
| oldSender contextToReturnTo result lookupClass |
contextToReturnTo := self.
lookupClass := superFlag
ifTrue: [self method methodClassAssociation value superclass]
+ ifFalse: [self objectClass: rcvr].
- ifFalse: [self objectClass: self receiver].
[oldSender := thisContext sender swapSender: self.
+ result := self object: rcvr perform: selector withArguments: arguments inClass: lookupClass.
+ thisContext sender swapSender: oldSender] ifCurtailed:
- result := self object: receiver perform: selector withArguments: arguments inClass: lookupClass.
- thisContext sender swapSender: oldSender] ifCurtailed:
[contextToReturnTo := thisContext sender receiver. "The block context returning nonlocally"
+ contextToReturnTo pc: contextToReturnTo previousPc. "skip to front of return bytecode causing this unwind"
+ contextToReturnTo willReturnTopFromMethod ifTrue:
- contextToReturnTo jump: -1. "skip to front of return bytecode causing this unwind"
- contextToReturnTo nextByte = 16r7C ifTrue:
"If it was a returnTop, push the value to be returned.
Otherwise the value is implicit in the bytecode"
[contextToReturnTo push: (thisContext sender tempAt: 1)].
thisContext swapSender: thisContext home sender. "Make this block return to the method's sender"
contextToReturnTo].
contextToReturnTo push: result.
^contextToReturnTo!
Item was added:
+ ----- Method: InstructionStream>>willReturnTopFromMethod (in category 'testing') -----
+ willReturnTopFromMethod
+ "Answer whether the next bytecode is a return stack top from method."
+ | method |
+ method := self method.
+ ^method encoderClass isReturnTopFromMethodAt: pc in: method!
Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.288.mcz
==================== Summary ====================
Name: Compiler-eem.288
Author: eem
Time: 2 September 2014, 2:22:13.42 pm
UUID: 79749887-066e-4675-9b9a-c39cae7f4ad4
Ancestors: Compiler-eem.287
Provide support for fixing ContextPart>>#quickSend:to:with:super:
=============== Diff against Compiler-eem.287 ===============
Item was added:
+ ----- Method: BytecodeEncoder class>>isReturnTopFromMethodAt:in: (in category 'instruction stream support') -----
+ isReturnTopFromMethodAt: pc in: method
+ "Answer whether the bytecode at pc is a return stack top from method."
+
+ self subclassResponsibility!
Item was added:
+ ----- Method: EncoderForV3 class>>isReturnTopFromMethodAt:in: (in category 'instruction stream support') -----
+ isReturnTopFromMethodAt: pc in: method
+ "Answer whether the bytecode at pc is a return stack top from method."
+
+ ^(method at: pc) = 124!
Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.288.mcz
==================== Summary ====================
Name: Compiler-eem.288
Author: eem
Time: 2 September 2014, 2:22:13.42 pm
UUID: 79749887-066e-4675-9b9a-c39cae7f4ad4
Ancestors: Compiler-eem.287
Provide support for fixing ContextPart>>#quickSend:to:with:super:
=============== Diff against Compiler-eem.287 ===============
Item was added:
+ ----- Method: BytecodeEncoder class>>isReturnTopFromMethodAt:in: (in category 'instruction stream support') -----
+ isReturnTopFromMethodAt: pc in: method
+ "Answer whether the bytecode at pc is a return stack top from method."
+
+ self subclassResponsibility!
Item was added:
+ ----- Method: EncoderForV3 class>>isReturnTopFromMethodAt:in: (in category 'instruction stream support') -----
+ isReturnTopFromMethodAt: pc in: method
+ "Answer whether the bytecode at pc is a return stack top from method."
+
+ ^(method at: pc) = 124!
Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.288.mcz
==================== Summary ====================
Name: Compiler-eem.288
Author: eem
Time: 2 September 2014, 2:22:13.42 pm
UUID: 79749887-066e-4675-9b9a-c39cae7f4ad4
Ancestors: Compiler-eem.287
Provide support for fixing ContextPart>>#quickSend:to:with:super:
=============== Diff against Compiler-eem.287 ===============
Item was added:
+ ----- Method: BytecodeEncoder class>>isReturnTopFromMethodAt:in: (in category 'instruction stream support') -----
+ isReturnTopFromMethodAt: pc in: method
+ "Answer whether the bytecode at pc is a return stack top from method."
+
+ self subclassResponsibility!
Item was added:
+ ----- Method: EncoderForV3 class>>isReturnTopFromMethodAt:in: (in category 'instruction stream support') -----
+ isReturnTopFromMethodAt: pc in: method
+ "Answer whether the bytecode at pc is a return stack top from method."
+
+ ^(method at: pc) = 124!