[prev in list] [next in list] [prev in thread] [next in thread]
List: squeak-dev
Subject: [squeak-dev] The Trunk: Kernel-jar.1550.mcz
From: commits () source ! squeak ! org
Date: 2024-03-05 20:36:43
Message-ID: 20240305203657.20CA4582603 () mail ! squeak ! org
[Download RAW message or body]
Christoph Thiede uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-jar.1550.mcz
==================== Summary ====================
Name: Kernel-jar.1550
Author: jar
Time: 9 January 2024, 8:36:02.1473 pm
UUID: f53ab664-7278-8944-8a7c-90660a08f773
Ancestors: Kernel-ct.1549
fix and rename private method #stepToCalleeOrNil to #stepToSenderOrNil
if you debug and do step through to ^2 and then step over in
[^2] ensure: []
the debugger incorrectly stops at #resume:through:.
The reason is #resume:through: sends a block as an argument and #stepToCalleeOrNil is \
just not right for this situation: the purpose of the #stepToSenderOrNil method is to \
remove the top context from the stack by stepping until the context returns. This \
means we're not interested in detecting stack increases provided by \
#stepToCalleeOrNil.
It is only used as a helper method in runUntilErrorOrReturnFrom:
=============== Diff against Kernel-ct.1549 ===============
Item was changed:
----- Method: Context>>runUntilErrorOrReturnFrom: (in category 'controlling') -----
runUntilErrorOrReturnFrom: aSender
"ASSUMES aSender is a sender of self. Execute self's stack until aSender returns \
or an unhandled exception is raised. Return a pair containing the new top context \
and a possibly nil exception. The exception is not nil if it was raised before \
aSender returned and it was not handled. The exception is returned rather than \
openning the debugger, giving the caller the choice of how to handle it." "Self is \
run by jumping directly to it (the active process abandons thisContext and executes \
self). However, before jumping to self we insert an ensure block under aSender that \
jumps back to thisContext when evaluated. We also insert an exception handler under \
aSender that jumps back to thisContext when an unhandled exception is raised. In \
either case, the inserted ensure and exception handler are removed once control jumps \
back to thisContext."
| error ctxt here topContext |
here := thisContext.
"Insert ensure and exception handler contexts under aSender"
error := nil.
ctxt := aSender insertSender: (Context
contextOn: UnhandledError do: [:ex |
error ifNil: [
error := ex exception.
topContext := thisContext.
ex resumeUnchecked: here jump]
ifNotNil: [ex pass]
]).
ctxt := ctxt insertSender: (Context
contextEnsure: [error ifNil: [
topContext := thisContext.
here jump]
]).
self jump. "Control jumps to self"
"Control resumes here once above ensure block or exception handler is executed"
^ error ifNil: [
"No error was raised, remove ensure context by stepping until popped"
+ [ctxt isDead or: [topContext isNil]] whileFalse: [topContext := topContext \
stepToSenderOrNil].
- [ctxt isDead or: [topContext isNil]] whileFalse: [topContext := topContext \
stepToCalleeOrNil]. {topContext. nil}
] ifNotNil: [
"Error was raised, remove inserted above contexts then return signaler context"
aSender terminateTo: ctxt sender. "remove above ensure and handler contexts"
{topContext. error}
]!
Item was removed:
- ----- Method: Context>>stepToCalleeOrNil (in category 'private') -----
- stepToCalleeOrNil
- "Step to callee or sender; step to return and answer nil in case sender cannot be \
returned to."
-
- | ctxt |
- ctxt := self.
- [(ctxt willReturn and: [ctxt sender isNil or: [ctxt sender isDead]]) not and: \
[(ctxt := ctxt step) == self]] whileTrue.
- ctxt == self ifTrue: [^nil].
- ^ctxt!
Item was added:
+ ----- Method: Context>>stepToSenderOrNil (in category 'private') -----
+ stepToSenderOrNil
+ "Step to sender or step to return and answer nil in case sender cannot be returned \
to." +
+ | ctxt |
+ ctxt := self.
+ [(ctxt willReturn and: [ctxt sender isNil or: [ctxt sender isDead]]) not and: \
[(ctxt := ctxt step) == self or: [ctxt hasSender: self]]] whileTrue. + ctxt == self \
ifTrue: [^nil]. + ^ctxt!
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic