--- a/Context.st Thu Jun 04 13:17:16 1998 +0200
+++ b/Context.st Thu Jun 04 17:18:52 1998 +0200
@@ -112,6 +112,9 @@
locals and temporaries.
sender <Context> the 'calling / sending' context
+ This is not directly accessable, since it may
+ be a lazy context (i.e. an empty frame).
+ The #sender method cares for this.
home <Context> the context, where this block was
created, or nil if its a method context
@@ -275,6 +278,7 @@
Notice, that one of the next ST/X versions will get some syntactic
extension to get this automatically)."
+ (index == 2) ifTrue:[^ self sender]."/ sender - must be accessed specially
(index == 8) ifTrue:[^ nil]. "/ retvalTemp - invisible
(index == 9) ifTrue:[^ nil]. "/ handle to machine stack - invisible
^ super instVarAt:index
@@ -305,7 +309,7 @@
To save time during normal execution, this information is not held in the
context, but computed here on request."
- |c sender sendersSelector|
+ |c sender sendersSelector m|
c := self searchClass.
"
@@ -324,7 +328,7 @@
^ c compiledMethodAt:selector
].
- "mhmh - seems to be a context for an unbound method;
+ "mhmh - seems to be a context for an unbound method (as generated by doIt);
look in the senders context. Consider this a kludge.
(maybe it was not too good of an idea to NOT keep the current
method in the context ...)
@@ -336,7 +340,10 @@
sendersSelector := sender selector.
sendersSelector notNil ifTrue:[
(sendersSelector startsWith:'valueWithReceiver:') ifTrue:[
- ^ sender receiver
+ m := sender receiver.
+ m isMethod ifTrue:[
+ ^ m
+ ]
]
]
].
@@ -448,11 +455,11 @@
%{ /* NOCONTEXT */
OBJ theContext;
+ theContext = __INST(sender_);
/*
* this special nil test is for the very first context (startup-context);
* actually, its cosmetics, to avoid a visible nil>>nil context in the debugger.
*/
- theContext = __INST(sender_);
if (__isNonNilObject(theContext)) {
if (__isLazy(theContext)) {
@@ -461,14 +468,16 @@
*/
__PATCHUPCONTEXT(theContext);
}
- /*
- * to be prepared for the worst situation
- * (the sender is not stored, so the trap wont catch it)
- * make the writeBarrier trigger manually.
- * We'll see, if this is really required.
- */
- theContext->o_space |= CATCHMARK;
- _markNonLIFO(theContext);
+ if (! __isNonLIFO(theContext)) {
+ /*
+ * to be prepared for the worst situation
+ * (the sender is not stored, so the trap wont catch it)
+ * make the writeBarrier trigger manually.
+ * We'll see, if this is really required.
+ */
+ theContext->o_space |= CATCHMARK;
+ _markNonLIFO(theContext);
+ }
}
RETURN (theContext);
%}
@@ -887,7 +896,7 @@
&& (__ContextInstPtr(theContext)->c_sender != self)) {
theContext = __ContextInstPtr(theContext)->c_sender;
}
- if (theContext) {
+ if (theContext != nil) {
if (__isLazy(theContext)) {
__PATCHUPCONTEXT(theContext);
}
@@ -1325,8 +1334,7 @@
- a highly internal mechanism and not for public use."
%{ /* NOCONTEXT */
- __INST(flags) = (OBJ)((INT)__INST(flags)
- | __MASKSMALLINT(__IRQ_ON_UNWIND));
+ __INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__IRQ_ON_UNWIND));
%}
!
@@ -1368,7 +1376,7 @@
%{ /* NOCONTEXT */
- RETURN ( (__intVal(__INST(flags)) & __CANNOT_RETURN) ? false : true );
+ RETURN ( ((INT)(__INST(flags)) & __MASKSMALLINT(__CANNOT_RETURN)) ? false : true );
%}
!
@@ -1483,6 +1491,6 @@
!Context class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.86 1998-03-31 13:52:54 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.87 1998-06-04 15:18:52 cg Exp $'
! !
Context initialize!