Mercurial > hg > truffle
annotate src/cpu/zero/vm/stack_zero.cpp @ 6415:033f95af9cd7
Create a loop project
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Mon, 17 Sep 2012 18:35:06 +0200 |
parents | d17bd0b18663 |
children |
rev | line source |
---|---|
1383 | 1 /* |
3843
d17bd0b18663
7066143: JSR 292: Zero support after regressions from 7009923 and 7009309
twisti
parents:
1972
diff
changeset
|
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. |
1383 | 3 * Copyright 2010 Red Hat, Inc. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
5 * | |
6 * This code is free software; you can redistribute it and/or modify it | |
7 * under the terms of the GNU General Public License version 2 only, as | |
8 * published by the Free Software Foundation. | |
9 * | |
10 * This code is distributed in the hope that it will be useful, but WITHOUT | |
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 * version 2 for more details (a copy is included in the LICENSE file that | |
14 * accompanied this code). | |
15 * | |
16 * You should have received a copy of the GNU General Public License version | |
17 * 2 along with this work; if not, write to the Free Software Foundation, | |
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1511
diff
changeset
|
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1511
diff
changeset
|
21 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1511
diff
changeset
|
22 * questions. |
1383 | 23 * |
24 */ | |
25 | |
1972 | 26 #include "precompiled.hpp" |
27 #include "interpreter/interpreterRuntime.hpp" | |
28 #include "stack_zero.hpp" | |
29 #include "stack_zero.inline.hpp" | |
1383 | 30 |
1511 | 31 int ZeroStack::suggest_size(Thread *thread) const { |
32 assert(needs_setup(), "already set up"); | |
33 return align_size_down(abi_stack_available(thread) / 2, wordSize); | |
34 } | |
35 | |
1383 | 36 void ZeroStack::handle_overflow(TRAPS) { |
37 JavaThread *thread = (JavaThread *) THREAD; | |
38 | |
39 // Set up the frame anchor if it isn't already | |
40 bool has_last_Java_frame = thread->has_last_Java_frame(); | |
41 if (!has_last_Java_frame) { | |
1505 | 42 intptr_t *sp = thread->zero_stack()->sp(); |
1383 | 43 ZeroFrame *frame = thread->top_zero_frame(); |
44 while (frame) { | |
45 if (frame->is_shark_frame()) | |
46 break; | |
47 | |
48 if (frame->is_interpreter_frame()) { | |
49 interpreterState istate = | |
50 frame->as_interpreter_frame()->interpreter_state(); | |
51 if (istate->self_link() == istate) | |
52 break; | |
53 } | |
54 | |
1505 | 55 sp = ((intptr_t *) frame) + 1; |
1383 | 56 frame = frame->next(); |
57 } | |
58 | |
59 if (frame == NULL) | |
60 fatal("unrecoverable stack overflow"); | |
61 | |
1505 | 62 thread->set_last_Java_frame(frame, sp); |
1383 | 63 } |
64 | |
65 // Throw the exception | |
66 switch (thread->thread_state()) { | |
67 case _thread_in_Java: | |
68 InterpreterRuntime::throw_StackOverflowError(thread); | |
69 break; | |
70 | |
71 case _thread_in_vm: | |
3843
d17bd0b18663
7066143: JSR 292: Zero support after regressions from 7009923 and 7009309
twisti
parents:
1972
diff
changeset
|
72 Exceptions::throw_stack_overflow_exception(thread, __FILE__, __LINE__, |
d17bd0b18663
7066143: JSR 292: Zero support after regressions from 7009923 and 7009309
twisti
parents:
1972
diff
changeset
|
73 methodHandle()); |
1383 | 74 break; |
75 | |
76 default: | |
77 ShouldNotReachHere(); | |
78 } | |
79 | |
80 // Reset the frame anchor if necessary | |
81 if (!has_last_Java_frame) | |
82 thread->reset_last_Java_frame(); | |
83 } | |
1505 | 84 |
85 #ifndef PRODUCT | |
86 void ZeroStack::zap(int c) { | |
87 memset(_base, c, available_words() * wordSize); | |
88 } | |
89 #endif // PRODUCT |