Mercurial > hg > graal-jvmci-8
annotate src/cpu/zero/vm/stack_zero.cpp @ 24234:ea6f94ab283b default tip
Added tag jvmci-0.36 for changeset 8128b98d4736
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Mon, 18 Sep 2017 18:49:45 +0200 |
parents | c6affd32651a |
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"); | |
22852
c6affd32651a
8064815: Zero+PPC64: Stack overflow when running Maven
simonis
parents:
3843
diff
changeset
|
33 int abi_available = abi_stack_available(thread); |
c6affd32651a
8064815: Zero+PPC64: Stack overflow when running Maven
simonis
parents:
3843
diff
changeset
|
34 assert(abi_available >= 0, "available abi stack must be >= 0"); |
c6affd32651a
8064815: Zero+PPC64: Stack overflow when running Maven
simonis
parents:
3843
diff
changeset
|
35 return align_size_down(abi_available / 2, wordSize); |
1511 | 36 } |
37 | |
1383 | 38 void ZeroStack::handle_overflow(TRAPS) { |
39 JavaThread *thread = (JavaThread *) THREAD; | |
40 | |
41 // Set up the frame anchor if it isn't already | |
42 bool has_last_Java_frame = thread->has_last_Java_frame(); | |
43 if (!has_last_Java_frame) { | |
1505 | 44 intptr_t *sp = thread->zero_stack()->sp(); |
1383 | 45 ZeroFrame *frame = thread->top_zero_frame(); |
46 while (frame) { | |
47 if (frame->is_shark_frame()) | |
48 break; | |
49 | |
50 if (frame->is_interpreter_frame()) { | |
51 interpreterState istate = | |
52 frame->as_interpreter_frame()->interpreter_state(); | |
53 if (istate->self_link() == istate) | |
54 break; | |
55 } | |
56 | |
1505 | 57 sp = ((intptr_t *) frame) + 1; |
1383 | 58 frame = frame->next(); |
59 } | |
60 | |
61 if (frame == NULL) | |
62 fatal("unrecoverable stack overflow"); | |
63 | |
1505 | 64 thread->set_last_Java_frame(frame, sp); |
1383 | 65 } |
66 | |
67 // Throw the exception | |
68 switch (thread->thread_state()) { | |
69 case _thread_in_Java: | |
70 InterpreterRuntime::throw_StackOverflowError(thread); | |
71 break; | |
72 | |
73 case _thread_in_vm: | |
3843
d17bd0b18663
7066143: JSR 292: Zero support after regressions from 7009923 and 7009309
twisti
parents:
1972
diff
changeset
|
74 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
|
75 methodHandle()); |
1383 | 76 break; |
77 | |
78 default: | |
79 ShouldNotReachHere(); | |
80 } | |
81 | |
82 // Reset the frame anchor if necessary | |
83 if (!has_last_Java_frame) | |
84 thread->reset_last_Java_frame(); | |
85 } | |
1505 | 86 |
87 #ifndef PRODUCT | |
88 void ZeroStack::zap(int c) { | |
89 memset(_base, c, available_words() * wordSize); | |
90 } | |
91 #endif // PRODUCT |