handle zero-length lookup tables in lookupswitch

This commit is contained in:
Joel Dice 2009-08-12 19:32:12 -06:00
parent db58097165
commit 61cb8b3deb

View File

@ -2228,6 +2228,8 @@ throw_(MyThread* t, object o)
t->exception = makeNullPointerException(t);
}
// printTrace(t, t->exception);
unwind(t);
}
@ -3811,6 +3813,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
int32_t pairCount = codeReadInt32(t, code, ip);
if (pairCount) {
Compiler::Operand* start = 0;
uint32_t ipTable[pairCount];
for (int32_t i = 0; i < pairCount; ++i) {
@ -3843,6 +3846,10 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
c->restoreState(state);
}
} else {
// a switch statement with no cases, apparently
c->jmp(default_);
}
ip = defaultIp;
} break;