6939182: Zero JNI handles fix

Zero will exit with an error when invoked with -Xcheck:jni.

Reviewed-by: twisti, kamg
This commit is contained in:
Gary Benson 2010-04-30 04:27:25 -07:00 committed by Christian Thalinger
parent 61b9d428d1
commit 55457c9cc7
8 changed files with 59 additions and 35 deletions

View file

@ -32,6 +32,7 @@ void ZeroStack::handle_overflow(TRAPS) {
// Set up the frame anchor if it isn't already
bool has_last_Java_frame = thread->has_last_Java_frame();
if (!has_last_Java_frame) {
intptr_t *sp = thread->zero_stack()->sp();
ZeroFrame *frame = thread->top_zero_frame();
while (frame) {
if (frame->is_shark_frame())
@ -44,13 +45,14 @@ void ZeroStack::handle_overflow(TRAPS) {
break;
}
sp = ((intptr_t *) frame) + 1;
frame = frame->next();
}
if (frame == NULL)
fatal("unrecoverable stack overflow");
thread->set_last_Java_frame(frame);
thread->set_last_Java_frame(frame, sp);
}
// Throw the exception
@ -71,3 +73,9 @@ void ZeroStack::handle_overflow(TRAPS) {
if (!has_last_Java_frame)
thread->reset_last_Java_frame();
}
#ifndef PRODUCT
void ZeroStack::zap(int c) {
memset(_base, c, available_words() * wordSize);
}
#endif // PRODUCT