Mercurial > hg > truffle
comparison src/cpu/zero/vm/stack_zero.cpp @ 1505:0c5b3cf3c1f5
6939182: Zero JNI handles fix
Summary: Zero will exit with an error when invoked with -Xcheck:jni.
Reviewed-by: twisti, kamg
Contributed-by: Gary Benson <gbenson@redhat.com>
author | twisti |
---|---|
date | Fri, 30 Apr 2010 04:27:25 -0700 |
parents | aa9c266de52a |
children | 348346af6676 |
comparison
equal
deleted
inserted
replaced
1504:ae8f909e5fc7 | 1505:0c5b3cf3c1f5 |
---|---|
30 JavaThread *thread = (JavaThread *) THREAD; | 30 JavaThread *thread = (JavaThread *) THREAD; |
31 | 31 |
32 // Set up the frame anchor if it isn't already | 32 // Set up the frame anchor if it isn't already |
33 bool has_last_Java_frame = thread->has_last_Java_frame(); | 33 bool has_last_Java_frame = thread->has_last_Java_frame(); |
34 if (!has_last_Java_frame) { | 34 if (!has_last_Java_frame) { |
35 intptr_t *sp = thread->zero_stack()->sp(); | |
35 ZeroFrame *frame = thread->top_zero_frame(); | 36 ZeroFrame *frame = thread->top_zero_frame(); |
36 while (frame) { | 37 while (frame) { |
37 if (frame->is_shark_frame()) | 38 if (frame->is_shark_frame()) |
38 break; | 39 break; |
39 | 40 |
42 frame->as_interpreter_frame()->interpreter_state(); | 43 frame->as_interpreter_frame()->interpreter_state(); |
43 if (istate->self_link() == istate) | 44 if (istate->self_link() == istate) |
44 break; | 45 break; |
45 } | 46 } |
46 | 47 |
48 sp = ((intptr_t *) frame) + 1; | |
47 frame = frame->next(); | 49 frame = frame->next(); |
48 } | 50 } |
49 | 51 |
50 if (frame == NULL) | 52 if (frame == NULL) |
51 fatal("unrecoverable stack overflow"); | 53 fatal("unrecoverable stack overflow"); |
52 | 54 |
53 thread->set_last_Java_frame(frame); | 55 thread->set_last_Java_frame(frame, sp); |
54 } | 56 } |
55 | 57 |
56 // Throw the exception | 58 // Throw the exception |
57 switch (thread->thread_state()) { | 59 switch (thread->thread_state()) { |
58 case _thread_in_Java: | 60 case _thread_in_Java: |
69 | 71 |
70 // Reset the frame anchor if necessary | 72 // Reset the frame anchor if necessary |
71 if (!has_last_Java_frame) | 73 if (!has_last_Java_frame) |
72 thread->reset_last_Java_frame(); | 74 thread->reset_last_Java_frame(); |
73 } | 75 } |
76 | |
77 #ifndef PRODUCT | |
78 void ZeroStack::zap(int c) { | |
79 memset(_base, c, available_words() * wordSize); | |
80 } | |
81 #endif // PRODUCT |