Tue, 24 Dec 2013 11:48:39 -0800
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
Summary: Copyright year updated for files modified during 2013
Reviewed-by: twisti, iveresov
twisti@1818 | 1 | /* |
twisti@3041 | 2 | * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. |
twisti@1818 | 3 | * Copyright 2010 Red Hat, Inc. |
twisti@1818 | 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
twisti@1818 | 5 | * |
twisti@1818 | 6 | * This code is free software; you can redistribute it and/or modify it |
twisti@1818 | 7 | * under the terms of the GNU General Public License version 2 only, as |
twisti@1818 | 8 | * published by the Free Software Foundation. |
twisti@1818 | 9 | * |
twisti@1818 | 10 | * This code is distributed in the hope that it will be useful, but WITHOUT |
twisti@1818 | 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
twisti@1818 | 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
twisti@1818 | 13 | * version 2 for more details (a copy is included in the LICENSE file that |
twisti@1818 | 14 | * accompanied this code). |
twisti@1818 | 15 | * |
twisti@1818 | 16 | * You should have received a copy of the GNU General Public License version |
twisti@1818 | 17 | * 2 along with this work; if not, write to the Free Software Foundation, |
twisti@1818 | 18 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
twisti@1818 | 19 | * |
trims@1907 | 20 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 21 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 22 | * questions. |
twisti@1818 | 23 | * |
twisti@1818 | 24 | */ |
twisti@1818 | 25 | |
stefank@2314 | 26 | #include "precompiled.hpp" |
stefank@2314 | 27 | #include "interpreter/interpreterRuntime.hpp" |
stefank@2314 | 28 | #include "stack_zero.hpp" |
stefank@2314 | 29 | #include "stack_zero.inline.hpp" |
twisti@1818 | 30 | |
twisti@1866 | 31 | int ZeroStack::suggest_size(Thread *thread) const { |
twisti@1866 | 32 | assert(needs_setup(), "already set up"); |
twisti@1866 | 33 | return align_size_down(abi_stack_available(thread) / 2, wordSize); |
twisti@1866 | 34 | } |
twisti@1866 | 35 | |
twisti@1818 | 36 | void ZeroStack::handle_overflow(TRAPS) { |
twisti@1818 | 37 | JavaThread *thread = (JavaThread *) THREAD; |
twisti@1818 | 38 | |
twisti@1818 | 39 | // Set up the frame anchor if it isn't already |
twisti@1818 | 40 | bool has_last_Java_frame = thread->has_last_Java_frame(); |
twisti@1818 | 41 | if (!has_last_Java_frame) { |
twisti@1860 | 42 | intptr_t *sp = thread->zero_stack()->sp(); |
twisti@1818 | 43 | ZeroFrame *frame = thread->top_zero_frame(); |
twisti@1818 | 44 | while (frame) { |
twisti@1818 | 45 | if (frame->is_shark_frame()) |
twisti@1818 | 46 | break; |
twisti@1818 | 47 | |
twisti@1818 | 48 | if (frame->is_interpreter_frame()) { |
twisti@1818 | 49 | interpreterState istate = |
twisti@1818 | 50 | frame->as_interpreter_frame()->interpreter_state(); |
twisti@1818 | 51 | if (istate->self_link() == istate) |
twisti@1818 | 52 | break; |
twisti@1818 | 53 | } |
twisti@1818 | 54 | |
twisti@1860 | 55 | sp = ((intptr_t *) frame) + 1; |
twisti@1818 | 56 | frame = frame->next(); |
twisti@1818 | 57 | } |
twisti@1818 | 58 | |
twisti@1818 | 59 | if (frame == NULL) |
twisti@1818 | 60 | fatal("unrecoverable stack overflow"); |
twisti@1818 | 61 | |
twisti@1860 | 62 | thread->set_last_Java_frame(frame, sp); |
twisti@1818 | 63 | } |
twisti@1818 | 64 | |
twisti@1818 | 65 | // Throw the exception |
twisti@1818 | 66 | switch (thread->thread_state()) { |
twisti@1818 | 67 | case _thread_in_Java: |
twisti@1818 | 68 | InterpreterRuntime::throw_StackOverflowError(thread); |
twisti@1818 | 69 | break; |
twisti@1818 | 70 | |
twisti@1818 | 71 | case _thread_in_vm: |
twisti@3041 | 72 | Exceptions::throw_stack_overflow_exception(thread, __FILE__, __LINE__, |
twisti@3041 | 73 | methodHandle()); |
twisti@1818 | 74 | break; |
twisti@1818 | 75 | |
twisti@1818 | 76 | default: |
twisti@1818 | 77 | ShouldNotReachHere(); |
twisti@1818 | 78 | } |
twisti@1818 | 79 | |
twisti@1818 | 80 | // Reset the frame anchor if necessary |
twisti@1818 | 81 | if (!has_last_Java_frame) |
twisti@1818 | 82 | thread->reset_last_Java_frame(); |
twisti@1818 | 83 | } |
twisti@1860 | 84 | |
twisti@1860 | 85 | #ifndef PRODUCT |
twisti@1860 | 86 | void ZeroStack::zap(int c) { |
twisti@1860 | 87 | memset(_base, c, available_words() * wordSize); |
twisti@1860 | 88 | } |
twisti@1860 | 89 | #endif // PRODUCT |