This commit is contained in:
Joel Dice 2007-10-02 18:22:48 -06:00
parent 68e382ca8d
commit f7058f8fd6
4 changed files with 460 additions and 340 deletions

File diff suppressed because it is too large Load Diff

View File

@ -682,6 +682,47 @@ populateMultiArray(Thread* t, object array, int32_t* counts,
}
}
ExceptionHandler*
findExceptionHandler(Thread* t, object method)
{
object eht = codeExceptionHandlerTable(t, methodCode(t, method));
if (eht) {
for (unsigned i = 0; i < exceptionHandlerTableLength(t, eht); ++i) {
ExceptionHandler* eh = exceptionHandlerTableBody(t, eht, i);
if (frameIp(t, frame) - 1 >= exceptionHandlerStart(eh)
and frameIp(t, frame) - 1 < exceptionHandlerEnd(eh))
{
object catchType = 0;
if (exceptionHandlerCatchType(eh)) {
object e = t->exception;
exception = 0;
PROTECT(t, e);
PROTECT(t, eht);
catchType = resolveClass
(t, codePool(t, code), exceptionHandlerCatchType(eh) - 1);
if (catchType) {
eh = exceptionHandlerTableBody(t, eht, i);
exception = e;
} else {
// can't find what we're supposed to catch - move on.
continue;
}
}
if (catchType == 0 or instanceOf(t, catchType, t->exception)) {
return eh;
}
}
}
}
return 0;
}
object
interpret(Thread* t)
{

View File

@ -145,48 +145,6 @@ resolveNativeMethod(Thread* t, object method)
return 0;
}
inline ExceptionHandler*
findExceptionHandler(Thread* t, object method)
{
object code = methodCode(t, method);
object eht = codeExceptionHandlerTable(t, code);
if (eht) {
for (unsigned i = 0; i < exceptionHandlerTableLength(t, eht); ++i) {
ExceptionHandler* eh = exceptionHandlerTableBody(t, eht, i);
if (frameIp(t, frame) - 1 >= exceptionHandlerStart(eh)
and frameIp(t, frame) - 1 < exceptionHandlerEnd(eh))
{
object catchType = 0;
if (exceptionHandlerCatchType(eh)) {
object e = t->exception;
exception = 0;
PROTECT(t, e);
PROTECT(t, eht);
catchType = resolveClass
(t, codePool(t, code), exceptionHandlerCatchType(eh) - 1);
if (catchType) {
eh = exceptionHandlerTableBody(t, eht, i);
exception = e;
} else {
// can't find what we're supposed to catch - move on.
continue;
}
}
if (catchType == 0 or instanceOf(t, catchType, t->exception)) {
return eh;
}
}
}
}
return 0;
}
} // namespace vm
#endif//PROCESS_H

View File

@ -50,9 +50,12 @@
(object spec)
(object class)
(object code)
(object compiled))
(void* compiled))
(type compiled
(nogc object pool)
(uint32_t lineNumbers)
(uint32_t exceptionHandlers)
(array uint8_t body))
(type nativeMethodData