The Trunk: Kernel-ar.321.mcz

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

The Trunk: Kernel-ar.321.mcz

commits-2
Andreas Raab uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ar.321.mcz

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

Name: Kernel-ar.321
Author: ar
Time: 4 December 2009, 6:26:38 am
UUID: 113aabe8-0043-514f-99e1-979ea0f8f647
Ancestors: Kernel-ar.320

Faster #ensure: handling: Instead of having the default path use thisContext>>tempAt:put: (which is very slow for the JIT) use a temp assignment and let only the termination handling actually do #tempAt:put:.

Part 1 introduces a version of #ensure: which is compatible with both versions of termination handling.


=============== Diff against Kernel-ar.320 ===============

Item was changed:
  ----- Method: BlockClosure>>ensure: (in category 'exceptions') -----
  ensure: aBlock
  "Evaluate a termination block after evaluating the receiver, regardless of whether the receiver's evaluation completes."
 
+ | complete returnValue b |
- | returnValue b |
  <primitive: 198>
  returnValue := self valueNoContextSwitch.
  "aBlock wasn't nil when execution of this method began; it is nil'd out by the unwind machinery, and that's how we know it's already been evaluated ... otherwise, obviously, it needs to be evaluated"
+ (aBlock == nil or:[complete == true]) ifFalse: [
- aBlock == nil ifFalse: [
  "nil out aBlock temp before evaluating aBlock so it is not executed again if aBlock remote returns"
  b := aBlock.
  thisContext tempAt: 1 put: nil.  "Could be aBlock := nil, but arguments cannot be modified"
+ complete := true.
  b value.
  ].
  ^ returnValue!

Item was changed:
  ----- Method: BlockContext>>ensure: (in category 'exceptions') -----
  ensure: aBlock
  "Evaluate a termination block after evaluating the receiver, regardless of whether the receiver's evaluation completes."
 
+ | complete returnValue b |
- | returnValue b |
  <primitive: 198>
  returnValue := self value.
  "aBlock wasn't nil when execution of this method began; it is nil'd out by the unwind machinery, and that's how we know it's already been evaluated ... otherwise, obviously, it needs to be evaluated"
+ (aBlock == nil or:[complete == true]) ifFalse: [
- aBlock == nil ifFalse: [
  "nil out aBlock temp before evaluating aBlock so it is not executed again if aBlock remote returns"
  b := aBlock.
  thisContext tempAt: 1 put: nil.  "aBlock := nil"
+ complete := true.
  b value.
  ].
  ^ returnValue!