fix continuations=true build

This commit is contained in:
Joel Dice 2011-01-27 11:54:41 -07:00
parent 5cedcf7833
commit b7157c802a
5 changed files with 44 additions and 27 deletions

View File

@ -2133,14 +2133,14 @@ makeCurrentContinuation(MyThread* t, void** targetIp, void** targetStack)
object c = makeContinuation
(t, 0, context, method, ip,
((frameSize
+ t->arch->frameFooterSize()
+ t->arch->returnAddressOffset()
- t->arch->frameReturnAddressSize()) * BytesPerWord),
((frameSize
+ t->arch->frameFooterSize()
+ t->arch->framePointerOffset()
- t->arch->frameReturnAddressSize()) * BytesPerWord),
(frameSize
+ t->arch->frameFooterSize()
+ t->arch->returnAddressOffset()
- t->arch->frameReturnAddressSize()) * BytesPerWord,
(frameSize
+ t->arch->frameFooterSize()
+ t->arch->framePointerOffset()
- t->arch->frameReturnAddressSize()) * BytesPerWord,
totalSize);
memcpy(&continuationBody(t, c, 0), top, totalSize * BytesPerWord);
@ -6780,6 +6780,8 @@ callContinuation(MyThread* t, object continuation, object result,
t->trace->nativeMethod = 0;
t->trace->targetMethod = 0;
popResources(t);
transition(t, ip, stack, continuation, t->trace);
vmJump(ip, stack, t, reinterpret_cast<uintptr_t>(result), 0);
@ -6857,6 +6859,10 @@ jumpAndInvoke(MyThread* t, object method, void* stack, ...)
RUNTIME_ARRAY_BODY(arguments)[i] = va_arg(a, uintptr_t);
}
va_end(a);
assert(t, t->exception == 0);
popResources(t);
vmJumpAndInvoke
(t, reinterpret_cast<void*>(methodAddress(t, method)),

View File

@ -59,11 +59,13 @@ LOCAL(vmInvoke_continuationTest):
#endif
movq %r10,(%rsp,%rdi,1)
#ifdef AVIAN_USE_FRAME_POINTER
// save the current base pointer in the frame and update it
movq CONTINUATION_FRAME_POINTER_OFFSET(%rcx),%rdi
movq %rbp,(%rsp,%rdi,1)
addq %rsp,%rdi
movq %rdi,%rbp
#endif
// consume the continuation
movq CONTINUATION_NEXT(%rcx),%rdi
@ -151,11 +153,13 @@ LOCAL(vmInvoke_offset):
#endif
movl %esi,(%esp,%edi,1)
#ifdef AVIAN_USE_FRAME_POINTER
// save the current base pointer in the frame and update it
movl CONTINUATION_FRAME_POINTER_OFFSET(%ecx),%edi
movl %ebp,(%esp,%edi,1)
addl %esp,%edi
movl %edi,%ebp
#endif
// consume the continuation
movl CONTINUATION_NEXT(%ecx),%edi

View File

@ -2843,28 +2843,19 @@ makeNewGeneral(Thread* t, object class_)
return instance;
}
void NO_RETURN
throw_(Thread* t, object e)
void
popResources(Thread* t)
{
assert(t, t->exception == 0);
Thread::Checkpoint* checkpoint = t->checkpoint;
expect(t, not checkpoint->noThrow);
t->exception = e;
while (t->resource != checkpoint->resource) {
while (t->resource != t->checkpoint->resource) {
Thread::Resource* r = t->resource;
t->resource = r->next;
fprintf(stderr, "unwind resource %p %p %p\n", r,
reinterpret_cast<void**>(r)[0],
reinterpret_cast<void***>(r)[0][0]);
r->release();
}
t->protector = checkpoint->protector;
checkpoint->unwind();
abort(t);
t->protector = t->checkpoint->protector;
}
object

View File

@ -2572,8 +2572,24 @@ makeThrowable(Thread* t, Machine::Type type, const char* format, ...)
return r;
}
void NO_RETURN
throw_(Thread* t, object e);
void
popResources(Thread* t);
inline void NO_RETURN
throw_(Thread* t, object e)
{
assert(t, t->exception == 0);
expect(t, not t->checkpoint->noThrow);
t->exception = e;
popResources(t);
t->checkpoint->unwind();
abort(t);
}
inline void NO_RETURN
throwNew(Thread* t, Machine::Type type)

View File

@ -3029,7 +3029,7 @@ class MyArchitecture: public Assembler::Architecture {
}
virtual int framePointerOffset() {
return -1;
return UseFramePointer ? -1 : 0;
}
virtual void plan