remove distinction between thunks and bootThunks in compile.cpp

Now that the AOT-compiled code image is position-independent, there is
no further need for this distinction.  In fact, it was harmful,
because we were still using runtime-generated thunks when we should
have been using the ones in the code image.  This resulted in
EXC_BAD_ACCESS errors on non-jailbroken iOS devices.
This commit is contained in:
Joel Dice 2011-09-30 13:17:28 -06:00
parent b862f5f90a
commit 88d614eb25

View File

@ -2255,9 +2255,6 @@ defaultThunk(MyThread* t);
uintptr_t
nativeThunk(MyThread* t);
uintptr_t
bootNativeThunk(MyThread* t);
uintptr_t
aioobThunk(MyThread* t);
@ -8816,9 +8813,9 @@ class MyProcessor: public Processor {
root(t, MethodTreeSentinal));
set(t, root(t, MethodTree), TreeNodeRight,
root(t, MethodTreeSentinal));
}
local::compileThunks(static_cast<MyThread*>(t), &codeAllocator);
local::compileThunks(static_cast<MyThread*>(t), &codeAllocator);
}
segFaultHandler.m = t->m;
expect(t, t->m->system->success
@ -8888,7 +8885,6 @@ class MyProcessor: public Processor {
SignalHandler divideByZeroHandler;
FixedAllocator codeAllocator;
ThunkCollection thunks;
ThunkCollection bootThunks;
unsigned callTableSize;
bool useNativeFeatures;
void* thunkTable[dummyIndex + 1];
@ -8913,7 +8909,7 @@ compileMethod2(MyThread* t, void* ip)
if ((methodFlags(t, target) & ACC_NATIVE)
and useLongJump(t, reinterpret_cast<uintptr_t>(ip)))
{
address = bootNativeThunk(t);
address = nativeThunk(t);
} else {
address = methodAddress(t, target);
}
@ -8960,7 +8956,7 @@ isThunk(MyThread* t, void* ip)
{
MyProcessor* p = processor(t);
return isThunk(&(p->thunks), ip) or isThunk(&(p->bootThunks), ip);
return isThunk(&(p->thunks), ip);
}
bool
@ -9024,9 +9020,7 @@ isThunkUnsafeStack(MyThread* t, void* ip)
{
MyProcessor* p = processor(t);
return isThunk(t, ip)
and (isThunkUnsafeStack(&(p->thunks), ip)
or isThunkUnsafeStack(&(p->bootThunks), ip));
return isThunk(t, ip) and isThunkUnsafeStack(&(p->thunks), ip);
}
object
@ -9274,14 +9268,14 @@ findThunks(MyThread* t, BootImage* image, uint8_t* code)
{
MyProcessor* p = processor(t);
p->bootThunks.default_ = thunkToThunk(image->thunks.default_, code);
p->bootThunks.defaultVirtual
p->thunks.default_ = thunkToThunk(image->thunks.default_, code);
p->thunks.defaultVirtual
= thunkToThunk(image->thunks.defaultVirtual, code);
p->bootThunks.native = thunkToThunk(image->thunks.native, code);
p->bootThunks.aioob = thunkToThunk(image->thunks.aioob, code);
p->bootThunks.stackOverflow
p->thunks.native = thunkToThunk(image->thunks.native, code);
p->thunks.aioob = thunkToThunk(image->thunks.aioob, code);
p->thunks.stackOverflow
= thunkToThunk(image->thunks.stackOverflow, code);
p->bootThunks.table = thunkToThunk(image->thunks.table, code);
p->thunks.table = thunkToThunk(image->thunks.table, code);
}
void
@ -9622,12 +9616,6 @@ defaultThunk(MyThread* t)
return reinterpret_cast<uintptr_t>(processor(t)->thunks.default_.start);
}
uintptr_t
bootDefaultThunk(MyThread* t)
{
return reinterpret_cast<uintptr_t>(processor(t)->bootThunks.default_.start);
}
uintptr_t
defaultVirtualThunk(MyThread* t)
{
@ -9641,12 +9629,6 @@ nativeThunk(MyThread* t)
return reinterpret_cast<uintptr_t>(processor(t)->thunks.native.start);
}
uintptr_t
bootNativeThunk(MyThread* t)
{
return reinterpret_cast<uintptr_t>(processor(t)->bootThunks.native.start);
}
uintptr_t
aioobThunk(MyThread* t)
{
@ -9662,8 +9644,7 @@ stackOverflowThunk(MyThread* t)
bool
unresolved(MyThread* t, uintptr_t methodAddress)
{
return methodAddress == defaultThunk(t)
or methodAddress == bootDefaultThunk(t);
return methodAddress == defaultThunk(t);
}
uintptr_t