Fix to allow using Smalltalk blocks even after the method containing

their definition has returned.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@36420 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2013-03-24 17:19:55 +00:00
parent b5aeea6a29
commit fd46046983
5 changed files with 19 additions and 22 deletions

View file

@ -1,3 +1,19 @@
2013-03-24 Wolfgang Lux <wolfgang.lux@gmail.com>
* STExecutionContext.h: Change type of instruction pointer attribute
to NSUInteger.
* STExecutionContext.m (-invalidate, -isValid): Invalidate an
execution context by setting its instruction pointer to NSNotFound.
* STMethodContext.m (-invalidate, -isValid):
* STBlockContext.m (-invalidate, -isValid): Delete method
implementations so that the method and home context attributes of a
method context and block context, respectively, are not destroyed when
the method or block returns.
Together these changes make it possible to use blocks even after the
method containing their definition has returned.
2013-03-24 Wolfgang Lux <wolfgang.lux@gmail.com>
* Externs.h (STInterpreterReturnException):

View file

@ -66,14 +66,6 @@
{
return homeContext;
}
- (void)invalidate
{
[self setHomeContext:nil];
}
- (BOOL)isValid
{
return [homeContext isValid];
}
- (unsigned)initialIP
{

View file

@ -33,7 +33,7 @@
STStack *stack;
unsigned instructionPointer;
NSUInteger instructionPointer;
}
- initWithStackSize:(unsigned)stackSize;

View file

@ -53,12 +53,11 @@ static unsigned nextId = 1;
}
- (void)invalidate
{
[self subclassResponsibility:_cmd];
instructionPointer = NSNotFound;
}
- (BOOL)isValid
{
[self subclassResponsibility:_cmd];
return NO;
return (instructionPointer != NSNotFound);
}
- (unsigned)instructionPointer
{

View file

@ -89,16 +89,6 @@
format:@"Should not set home context of method context"];
}
- (void)invalidate
{
RELEASE(method);
method = nil;
}
- (BOOL)isValid
{
return (method != nil);
}
- (STCompiledMethod*)method
{
return method;