The Trunk: Kernel-eem.876.mcz

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

The Trunk: Kernel-eem.876.mcz

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

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

Name: Kernel-eem.876
Author: eem
Time: 29 September 2014, 2:21:45.514 pm
UUID: 9ea5bea7-14c9-48c9-9d49-ca311d68d49a
Ancestors: Kernel-ul.875

Fix handleSignal: for a rare edge case that can
occur on Stack & Cog VMs.

=============== Diff against Kernel-ul.875 ===============

Item was changed:
  ----- Method: ContextPart>>handleSignal: (in category 'private-exceptions') -----
  handleSignal: exception
+ "Sent to handler (on:do:) contexts only.  If my exception class (first arg) handles exception
+ and the handler is active then execute my handle block (second arg), otherwise forward
+ this message to the next handler context.  If none left, execute exception's defaultAction
+ (see nil>>handleSignal:)."
- "Sent to handler (on:do:) contexts only.  If my exception class (first arg) handles exception then execute my handle block (second arg), otherwise forward this message to the next handler context.  If none left, execute exception's defaultAction (see nil>>handleSignal:)."
 
+ | handlerActive val |
+ "If the context has been returned from the handlerActive temp var may not be accessible."
+ handlerActive := stackp >= 3 and: [(self tempAt: 3) == true].
+ (((self tempAt: 1) handles: exception) and: [handlerActive]) ifFalse:
+ [^self nextHandlerContext handleSignal: exception].
- | val |
- (((self tempAt: 1) handles: exception) and: [self tempAt: 3]) ifFalse: [
- ^ self nextHandlerContext handleSignal: exception].
 
  exception privHandlerContext: self contextTag.
  self tempAt: 3 put: false.  "disable self while executing handle block"
+ val := [(self tempAt: 2) cull: exception]
+ ensure: [self tempAt: 3 put: true].
+ self return: val  "return from self if not otherwise directed in handle block"
- val := [(self tempAt: 2) cull: exception ]
- ensure: [self tempAt: 3 put: true].
- self return: val.  "return from self if not otherwise directed in handle block"
  !


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-eem.876.mcz

Nicolas Cellier
So generally, all tempAt: accesses should be protected?

2014-09-29 23:22 GMT+02:00 <[hidden email]>:
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.876.mcz

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

Name: Kernel-eem.876
Author: eem
Time: 29 September 2014, 2:21:45.514 pm
UUID: 9ea5bea7-14c9-48c9-9d49-ca311d68d49a
Ancestors: Kernel-ul.875

Fix handleSignal: for a rare edge case that can
occur on Stack & Cog VMs.

=============== Diff against Kernel-ul.875 ===============

Item was changed:
  ----- Method: ContextPart>>handleSignal: (in category 'private-exceptions') -----
  handleSignal: exception
+       "Sent to handler (on:do:) contexts only.  If my exception class (first arg) handles exception
+        and the handler is active then execute my handle block (second arg), otherwise forward
+        this message to the next handler context.  If none left, execute exception's defaultAction
+        (see nil>>handleSignal:)."
-       "Sent to handler (on:do:) contexts only.  If my exception class (first arg) handles exception then execute my handle block (second arg), otherwise forward this message to the next handler context.  If none left, execute exception's defaultAction (see nil>>handleSignal:)."

+       | handlerActive val |
+       "If the context has been returned from the handlerActive temp var may not be accessible."
+       handlerActive := stackp >= 3 and: [(self tempAt: 3) == true].
+       (((self tempAt: 1) handles: exception) and: [handlerActive]) ifFalse:
+               [^self nextHandlerContext handleSignal: exception].
-       | val |
-       (((self tempAt: 1) handles: exception) and: [self tempAt: 3]) ifFalse: [
-               ^ self nextHandlerContext handleSignal: exception].

        exception privHandlerContext: self contextTag.
        self tempAt: 3 put: false.  "disable self while executing handle block"
+       val := [(self tempAt: 2) cull: exception]
+                       ensure: [self tempAt: 3 put: true].
+       self return: val  "return from self if not otherwise directed in handle block"
-       val := [(self tempAt: 2) cull: exception ]
-               ensure: [self tempAt: 3 put: true].
-       self return: val.  "return from self if not otherwise directed in handle block"
  !





Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-eem.876.mcz

Eliot Miranda-2
Hi Nicolas,

On Sep 29, 2014, at 11:15 PM, Nicolas Cellier <[hidden email]> wrote:

So generally, all tempAt: accesses should be protected?

No.  Accesses to arguments will always be ok, hence no guard in tempAt: 1 below (the Exception argument).  Further, if the context has not been returned from then all its temps will be accessible.  These guards should be few and far between.

Eliot (phone)


2014-09-29 23:22 GMT+02:00 <[hidden email]>:
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.876.mcz

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

Name: Kernel-eem.876
Author: eem
Time: 29 September 2014, 2:21:45.514 pm
UUID: 9ea5bea7-14c9-48c9-9d49-ca311d68d49a
Ancestors: Kernel-ul.875

Fix handleSignal: for a rare edge case that can
occur on Stack & Cog VMs.

=============== Diff against Kernel-ul.875 ===============

Item was changed:
  ----- Method: ContextPart>>handleSignal: (in category 'private-exceptions') -----
  handleSignal: exception
+       "Sent to handler (on:do:) contexts only.  If my exception class (first arg) handles exception
+        and the handler is active then execute my handle block (second arg), otherwise forward
+        this message to the next handler context.  If none left, execute exception's defaultAction
+        (see nil>>handleSignal:)."
-       "Sent to handler (on:do:) contexts only.  If my exception class (first arg) handles exception then execute my handle block (second arg), otherwise forward this message to the next handler context.  If none left, execute exception's defaultAction (see nil>>handleSignal:)."

+       | handlerActive val |
+       "If the context has been returned from the handlerActive temp var may not be accessible."
+       handlerActive := stackp >= 3 and: [(self tempAt: 3) == true].
+       (((self tempAt: 1) handles: exception) and: [handlerActive]) ifFalse:
+               [^self nextHandlerContext handleSignal: exception].
-       | val |
-       (((self tempAt: 1) handles: exception) and: [self tempAt: 3]) ifFalse: [
-               ^ self nextHandlerContext handleSignal: exception].

        exception privHandlerContext: self contextTag.
        self tempAt: 3 put: false.  "disable self while executing handle block"
+       val := [(self tempAt: 2) cull: exception]
+                       ensure: [self tempAt: 3 put: true].
+       self return: val  "return from self if not otherwise directed in handle block"
-       val := [(self tempAt: 2) cull: exception ]
-               ensure: [self tempAt: 3 put: true].
-       self return: val.  "return from self if not otherwise directed in handle block"
  !