more work on tail recursion

We now create a unique thunk for each vtable position so as to avoid
relying on using the return address to determine what method is to be
compiled and invoked, since we will not have the correct return address
in the case of a tail call.  This required refactoring how executable
memory is allocated in order to keep AOT compilation working.  Also, we
must always use the same register to hold the class pointer when
compiling virtual calls, and ensure that the pointer stays there until
the call instruction is executed so we know where to find it in the
thunk.
This commit is contained in:
Joel Dice
2009-04-05 15:42:10 -06:00
parent 5e740170f2
commit fea92ed995
11 changed files with 347 additions and 140 deletions

View File

@ -37,7 +37,7 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
const char* methodName, const char* methodSpec)
{
unsigned size = 0;
t->m->processor->compileThunks(t, image, code, &size, capacity);
t->m->processor->initialize(t, image, code, &size, capacity);
object constants = 0;
PROTECT(t, constants);
@ -79,8 +79,7 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
== 0)))
{
t->m->processor->compileMethod
(t, zone, code, &size, capacity, &constants, &calls, &addresses,
method);
(t, zone, &constants, &calls, &addresses, method);
}
}
}