The Trunk: Kernel-eem.895.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-eem.895.mcz

commits-2
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.895.mcz

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

Name: Kernel-eem.895
Author: eem
Time: 29 January 2015, 1:52:39.767 pm
UUID: 2872309b-7fd4-4911-9606-9993d569e1c7
Ancestors: Kernel-ul.893

Change Process>>evaluate:onBehalfOf: to update
all non-scheduling variables, such as name and env,
to ensure that access to these variables during
debugging answers those of the debugged process.

This is a smaller, if tricker, change than that in
Kernel-eem.894

=============== Diff against Kernel-ul.893 ===============

Item was changed:
  ----- Method: Process>>evaluate:onBehalfOf: (in category 'private') -----
  evaluate: aBlock onBehalfOf: aProcess
+ "Evaluate aBlock setting effectiveProcess to aProcess, and all other variables other than
+ the scheduling ones to those of aProcess.  Used in the execution simulation machinery
+ to ensure that Processor activeProcess evaluates correctly when debugging."
+ | range savedVariables |
+ "range accesses everything after myList, e.g. threadId, effectiveProcess, name, island, env"
+ range := 5 to: Process instSize.
+ savedVariables := range collect: [:i| self instVarAt: i].
+ range do:
+ [:i| self instVarAt: i put: (aProcess instVarAt: i)].
- "Evaluate aBlock setting effectiveProcess to aProcess.  Used
- in the execution simulation machinery to ensure that
- Processor activeProcess evaluates correctly when debugging."
- | oldEffectiveProcess |
- oldEffectiveProcess := effectiveProcess.
  effectiveProcess := aProcess.
+ ^aBlock ensure:
+ ["write back any assigned-to variables."
+ range do:
+ [:i| | v |
+ (v := self instVarAt: i) ~~ (aProcess instVarAt: i) ifTrue:
+ [aProcess instVarAt: i put: v]].
+ "restore old values"
+ range with: savedVariables do:
+ [:i :var| self instVarAt: i put: var]]!
- ^aBlock ensure: [effectiveProcess := oldEffectiveProcess]!